From 556e144628280a3afc87fe567c2f8ebb7b126213 Mon Sep 17 00:00:00 2001 From: bjarni Date: Sat, 18 Mar 2006 15:55:24 +0000 Subject: (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-) --- saveload.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'saveload.c') 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; -- cgit v1.2.3-54-g00ecf