mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Saves: Make the save filename counter automatically take the highest number present so as to not fill in gaps (which would make sorting inaccurate)
git-svn-id: https://svn.eduke32.com/eduke32@6747 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d04d0128e3
commit
210df6f92d
1 changed files with 19 additions and 1 deletions
|
@ -232,6 +232,24 @@ void ReadSaveGameHeaders(void)
|
|||
g_menusaves[y++] = msv;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t x = g_numinternalsaves-1; x < g_numinternalsaves; --x)
|
||||
{
|
||||
char const * const path = g_internalsaves[x].brief.path;
|
||||
size_t const pathlen = strlen(path);
|
||||
if (pathlen < 12)
|
||||
continue;
|
||||
char const * const fn = path + (pathlen-12);
|
||||
if (fn[0] == 's' && fn[1] == 'a' && fn[2] == 'v' && fn[3] == 'e' &&
|
||||
isdigit(fn[4]) && isdigit(fn[5]) && isdigit(fn[6]) && isdigit(fn[7]))
|
||||
{
|
||||
char number[5];
|
||||
memcpy(number, fn+4, 4);
|
||||
number[4] = '\0';
|
||||
savecounter.count = atoi(number)+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh)
|
||||
|
@ -257,7 +275,7 @@ int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh)
|
|||
{
|
||||
if (kdfread((char *)waloff[TILE_LOADSHOT], 320, 200, fil) != 200)
|
||||
{
|
||||
OSD_Printf("G_LoadSaveHeaderNew(): failed reading screenshot \"%s\"\n", fn);
|
||||
OSD_Printf("G_LoadSaveHeaderNew(): failed reading screenshot in \"%s\"\n", fn);
|
||||
goto corrupt;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue