mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Make g_grpNamePtr memory-clean, extern clearGrpNamePtr().
git-svn-id: https://svn.eduke32.com/eduke32@2563 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
55f3fdb9bc
commit
b06ce8456a
4 changed files with 23 additions and 11 deletions
|
@ -119,8 +119,8 @@ char defsfilename[BMAX_PATH] = "duke3d.def";
|
|||
static char defaultconfilename[2][BMAX_PATH] = { "EDUKE.CON", "GAME.CON" };
|
||||
const char *defaultrtsfilename = "DUKE.RTS";
|
||||
|
||||
// g_defNamePtr can ONLY point to one of: defaultduke3dgrp,
|
||||
// settings[].selectedgrp, malloc'd block (all length BMAX_PATH)
|
||||
// g_grpNamePtr can ONLY point to one of: defaultduke3dgrp, malloc'd block (all
|
||||
// length BMAX_PATH)
|
||||
char *g_grpNamePtr = defaultduke3dgrp;
|
||||
// g_defNamePtr can ONLY point to one of: defsfilename, malloc'd block (all
|
||||
// length BMAX_PATH)
|
||||
|
@ -134,12 +134,10 @@ const char *g_gameNamePtr = NULL;
|
|||
// g_rtsNamePtr can point to an argv[] element
|
||||
const char *g_rtsNamePtr = NULL;
|
||||
|
||||
// FIXME: I am leaking!
|
||||
// FIXME: make me extern!
|
||||
static void clearGrpNamePtr(void)
|
||||
void clearGrpNamePtr(void)
|
||||
{
|
||||
// if (g_grpNamePtr != defaultduke3dgrp) && not one of settings[].selectedgrp
|
||||
// Bfree(g_grpNamePtr);
|
||||
if (g_grpNamePtr != defaultduke3dgrp)
|
||||
Bfree(g_grpNamePtr);
|
||||
// g_grpNamePtr assumed to be assigned to right after
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,9 @@ extern int8_t g_noFloorPal[MAXPALOOKUPS];
|
|||
extern user_defs ud;
|
||||
|
||||
//extern int32_t g_yax_smoothratio;
|
||||
|
||||
void clearDefNamePtr(void);
|
||||
void clearGrpNamePtr(void);
|
||||
|
||||
int32_t A_CheckInventorySprite(spritetype *s);
|
||||
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
|
||||
|
|
|
@ -31,6 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "grpscan.h"
|
||||
#include "build.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "common.h"
|
||||
|
||||
#define RDR_POLYMOST 3 // sould be defined elsewhere
|
||||
#define RDR_POLYMER 4 // sould be defined elsewhere
|
||||
|
||||
|
@ -883,7 +886,7 @@ int32_t startwin_run(void)
|
|||
settings.custommoddir = g_modDir;
|
||||
settings.forcesetup = ud.config.ForceSetup;
|
||||
settings.game = g_gameType;
|
||||
Bstrncpy(settings.selectedgrp, g_grpNamePtr, BMAX_PATH);
|
||||
Bstrncpyz(settings.selectedgrp, g_grpNamePtr, BMAX_PATH);
|
||||
if (ud.config.NoAutoLoad) settings.autoload = FALSE;
|
||||
else settings.autoload = TRUE;
|
||||
#ifdef POLYMER
|
||||
|
@ -909,7 +912,10 @@ int32_t startwin_run(void)
|
|||
ud.config.UseMouse = settings.usemouse;
|
||||
ud.config.UseJoystick = settings.usejoy;
|
||||
ud.config.ForceSetup = settings.forcesetup;
|
||||
g_grpNamePtr = settings.selectedgrp;
|
||||
|
||||
clearGrpNamePtr();
|
||||
g_grpNamePtr = dup_filename(settings.selectedgrp);
|
||||
|
||||
g_gameType = settings.game;
|
||||
if (settings.custommoddir != NULL)
|
||||
Bstrcpy(g_modDir, settings.custommoddir);
|
||||
|
|
|
@ -44,6 +44,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "startwin.game.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "common.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
// #define TAB_GAME 1
|
||||
#define TAB_MESSAGES 1
|
||||
|
@ -735,7 +738,7 @@ int32_t startwin_run(void)
|
|||
settings.usejoy = ud.config.UseJoystick;
|
||||
settings.game = g_gameType;
|
||||
// settings.crcval = 0;
|
||||
Bstrncpy(settings.selectedgrp, g_grpNamePtr, BMAX_PATH);
|
||||
Bstrncpyz(settings.selectedgrp, g_grpNamePtr, BMAX_PATH);
|
||||
settings.gamedir = g_modDir;
|
||||
PopulateForm(-1);
|
||||
|
||||
|
@ -775,7 +778,10 @@ int32_t startwin_run(void)
|
|||
ud.config.ForceSetup = settings.forcesetup;
|
||||
ud.config.UseMouse = settings.usemouse;
|
||||
ud.config.UseJoystick = settings.usejoy;
|
||||
g_grpNamePtr = settings.selectedgrp;
|
||||
|
||||
clearGrpNamePtr();
|
||||
g_grpNamePtr = dup_filename(settings.selectedgrp);
|
||||
|
||||
g_gameType = settings.game;
|
||||
|
||||
if (g_noSetup == 0 && settings.gamedir != NULL)
|
||||
|
|
Loading…
Reference in a new issue