summaryrefslogtreecommitdiff
path: root/win32.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
commit3763ec7652c8421ad18cb59ec88a0bd448e2ab23 (patch)
treefb7abed850d590f522d3f6dcc8eeb2592af6893e /win32.c
parentcc99c3e262180a25209e120ac38dc5fefc4201d4 (diff)
downloadopenttd-3763ec7652c8421ad18cb59ec88a0bd448e2ab23.tar.xz
(svn r2012) When making a savegame name, don't append the extension, if it is already there
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/win32.c b/win32.c
index 8f1e124d3..7003e7aef 100644
--- a/win32.c
+++ b/win32.c
@@ -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)