1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-18 03:59:09 +00:00

(svn r2012) When making a savegame name, don't append the extension, if it is already there

This commit is contained in:
tron
2005-03-15 14:06:28 +00:00
parent cc99c3e262
commit 3763ec7652
3 changed files with 33 additions and 6 deletions

13
os2.c
View File

@@ -392,10 +392,19 @@ StringID FiosGetDescText(const char **path)
void FiosMakeSavegameName(char *buf, const char *name)
{
const char* extension;
const char* period;
if (_game_mode == GM_EDITOR)
sprintf(buf, "%s\\%s.scn", _fios_path, name);
extension = ".scn";
else
sprintf(buf, "%s\\%s.sav", _fios_path, name);
extension = ".sav";
// Don't append the extension, if it is already there
period = strrchr(name, '.');
if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
sprintf(buf, "%s\\%s%s", _fios_path, name, extension);
}
void FiosDelete(const char *name)

13
unix.c
View File

@@ -324,10 +324,19 @@ StringID FiosGetDescText(const char **path)
void FiosMakeSavegameName(char *buf, const char *name)
{
const char* extension;
const char* period;
if (_game_mode == GM_EDITOR)
sprintf(buf, "%s/%s.scn", _fios_path, name);
extension = ".scn";
else
sprintf(buf, "%s/%s.sav", _fios_path, name);
extension = ".sav";
// Don't append the extension, if it is already there
period = strrchr(name, '.');
if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
sprintf(buf, "%s/%s%s", _fios_path, name, extension);
}
void FiosDelete(const char *name)

13
win32.c
View File

@@ -1848,10 +1848,19 @@ StringID FiosGetDescText(const char **path)
void FiosMakeSavegameName(char *buf, const char *name)
{
const char* extension;
const char* period;
if (_game_mode == GM_EDITOR)
sprintf(buf, "%s\\%s.scn", _fios_path, name);
extension = ".scn";
else
sprintf(buf, "%s\\%s.sav", _fios_path, name);
extension = ".sav";
// Don't append the extension, if it is already there
period = strrchr(name, '.');
if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
sprintf(buf, "%s\\%s%s", _fios_path, name, extension);
}
void FiosDelete(const char *name)