summaryrefslogtreecommitdiff
path: root/saveload.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-03-18 15:55:24 +0000
committerbjarni <bjarni@openttd.org>2006-03-18 15:55:24 +0000
commit556e144628280a3afc87fe567c2f8ebb7b126213 (patch)
tree240b4d0c38dee55ec5f9f4f31011e3dacf7c8d3e /saveload.c
parent69399cfcb5cafb6da1f9b9b80e62f6914fe474a9 (diff)
downloadopenttd-556e144628280a3afc87fe567c2f8ebb7b126213.tar.xz
(svn r3966) -Fix: [OSX and some linux] [ 1157244 ] Can't save game if name contains german umlauts
now it saves correctly, but the load window still display some chars wrong (fix by ln-)
Diffstat (limited to 'saveload.c')
-rw-r--r--saveload.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/saveload.c b/saveload.c
index fd6c34699..2371450f6 100644
--- a/saveload.c
+++ b/saveload.c
@@ -1314,6 +1314,12 @@ extern bool AfterLoadGame(void);
extern void BeforeSaveGame(void);
extern bool LoadOldSaveGame(const char *file);
+#ifdef UNIX
+extern const char *convert_to_fs_charset(const char *filename);
+#else
+#define convert_to_fs_charset(str) (str)
+#endif // UNIX
+
/** Small helper function to close the to be loaded savegame an signal error */
static inline SaveOrLoadResult AbortSaveLoad(void)
{
@@ -1418,7 +1424,6 @@ void WaitTillSaved(void)
save_thread = NULL;
}
-
/**
* Main Save or Load function where the high-level saveload functions are
* handled. It opens the savegame, selects format and checks versions
@@ -1449,7 +1454,11 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
return SL_OK;
}
- _sl.fh = fopen(filename, (mode == SL_SAVE) ? "wb" : "rb");
+ if(mode == SL_SAVE) {
+ _sl.fh = fopen(convert_to_fs_charset(filename), "wb");
+ } else {
+ _sl.fh = fopen(filename, "rb");
+ }
if (_sl.fh == NULL) {
DEBUG(misc, 0) ("[Sl] Cannot open savegame for saving/loading.");
return SL_ERROR;