summaryrefslogtreecommitdiff
path: root/os2.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-15 14:06:28 +0000
committertron <tron@openttd.org>2005-03-15 14:06:28 +0000
commit0cb2ba49ebe701c884c40bf5c50193776e50ef9b (patch)
treefb7abed850d590f522d3f6dcc8eeb2592af6893e /os2.c
parentd0ea6bcdf0b470c39fbe280de678e51015dd7e4f (diff)
downloadopenttd-0cb2ba49ebe701c884c40bf5c50193776e50ef9b.tar.xz
(svn r2012) When making a savegame name, don't append the extension, if it is already there
Diffstat (limited to 'os2.c')
-rw-r--r--os2.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/os2.c b/os2.c
index 064dac66b..2764c3454 100644
--- a/os2.c
+++ b/os2.c
@@ -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)