savegame.c: fix compilation warnings with release build, add timing for debug

git-svn-id: https://svn.eduke32.com/eduke32@2218 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-28 20:33:54 +00:00
parent 8007da7190
commit d1d94e083f

View file

@ -861,7 +861,6 @@ int32_t G_SavePlayer(int32_t spot)
char fn[16]; char fn[16];
// char mpfn[16]; // char mpfn[16];
FILE *fil; FILE *fil;
int32_t ret;
Bstrcpy(fn, "dukesav0.esv"); Bstrcpy(fn, "dukesav0.esv");
fn[7] = spot + '0'; fn[7] = spot + '0';
@ -887,7 +886,7 @@ int32_t G_SavePlayer(int32_t spot)
} }
// SAVE! // SAVE!
ret = sv_saveandmakesnapshot(fil, spot, 0, 0, 0); sv_saveandmakesnapshot(fil, spot, 0, 0, 0);
fclose(fil); fclose(fil);
@ -2460,15 +2459,18 @@ static void sv_restload()
} }
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
# define PRINTSIZE(name) do { if (mem) OSD_Printf(name ": %d\n", (int32_t)(mem-tmem)); tmem=mem; } while (0) # define PRINTSIZE(name) do { if (mem) OSD_Printf(name ": %d\n", (int32_t)(mem-tmem)); \
OSD_Printf(name ": %d ms\n", getticks()-t); t=getticks(); tmem=mem; } while (0)
#else #else
# define PRINTSIZE(name) do { tmem=mem; } while (0) # define PRINTSIZE(name) do { } while (0)
#endif #endif
static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem) static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem)
{ {
#ifdef DEBUGGINGAIDS
uint8_t *tmem = mem; uint8_t *tmem = mem;
int32_t t=getticks();
#endif
mem=writespecdata(svgm_udnetw, fil, mem); // user settings, players & net mem=writespecdata(svgm_udnetw, fil, mem); // user settings, players & net
PRINTSIZE("ud"); PRINTSIZE("ud");
mem=writespecdata(svgm_secwsp, fil, mem); // sector, wall, sprite mem=writespecdata(svgm_secwsp, fil, mem); // sector, wall, sprite
@ -2490,8 +2492,11 @@ static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem)
static int32_t doloadplayer2(int32_t fil, uint8_t **memptr) static int32_t doloadplayer2(int32_t fil, uint8_t **memptr)
{ {
uint8_t *mem = memptr ? *memptr : NULL, *tmem=mem; uint8_t *mem = memptr ? *memptr : NULL;
#ifdef DEBUGGINGAIDS
uint8_t *tmem=mem;
int32_t t=getticks();
#endif
if (readspecdata(svgm_udnetw, fil, &mem)) return -2; if (readspecdata(svgm_udnetw, fil, &mem)) return -2;
PRINTSIZE("ud"); PRINTSIZE("ud");
if (readspecdata(svgm_secwsp, fil, &mem)) return -4; if (readspecdata(svgm_secwsp, fil, &mem)) return -4;
@ -2513,8 +2518,8 @@ static int32_t doloadplayer2(int32_t fil, uint8_t **memptr)
Bmemcpy(mem, svgm_vars[i].ptr, svgm_vars[i].size*svgm_vars[i].cnt); // careful! works because there are no DS_DYNAMIC's! Bmemcpy(mem, svgm_vars[i].ptr, svgm_vars[i].size*svgm_vars[i].cnt); // careful! works because there are no DS_DYNAMIC's!
mem += svgm_vars[i].size*svgm_vars[i].cnt; mem += svgm_vars[i].size*svgm_vars[i].cnt;
} }
PRINTSIZE("vars");
} }
PRINTSIZE("vars");
if (memptr) if (memptr)
*memptr = mem; *memptr = mem;