mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 12:36:16 -04:00
check for existing savegame files ignoring case (#1797)
* check for existing savegame files ignoring case * variable naming
This commit is contained in:
parent
8649af73c4
commit
d98a8476eb
29
src/g_game.c
29
src/g_game.c
@ -2159,14 +2159,39 @@ char* G_SaveGameName(int slot)
|
|||||||
char buf[16] = {0};
|
char buf[16] = {0};
|
||||||
sprintf(buf, "%.7s%d.dsg", savegamename, 10*savepage+slot);
|
sprintf(buf, "%.7s%d.dsg", savegamename, 10*savepage+slot);
|
||||||
|
|
||||||
return M_StringJoin(basesavegame, DIR_SEPARATOR_S, buf);
|
char *filepath = M_StringJoin(basesavegame, DIR_SEPARATOR_S, buf);
|
||||||
|
char *existing = M_FileCaseExists(filepath);
|
||||||
|
|
||||||
|
if (existing)
|
||||||
|
{
|
||||||
|
free(filepath);
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *filename = (char *)M_BaseName(filepath);
|
||||||
|
M_StringToLower(filename);
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* G_MBFSaveGameName(int slot)
|
char* G_MBFSaveGameName(int slot)
|
||||||
{
|
{
|
||||||
char buf[16] = {0};
|
char buf[16] = {0};
|
||||||
sprintf(buf, "MBFSAV%d.dsg", 10*savepage+slot);
|
sprintf(buf, "MBFSAV%d.dsg", 10*savepage+slot);
|
||||||
return M_StringJoin(basesavegame, DIR_SEPARATOR_S, buf);
|
|
||||||
|
char *filepath = M_StringJoin(basesavegame, DIR_SEPARATOR_S, buf);
|
||||||
|
char *existing = M_FileCaseExists(filepath);
|
||||||
|
|
||||||
|
if (existing)
|
||||||
|
{
|
||||||
|
free(filepath);
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// killough 12/98:
|
// killough 12/98:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user