1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-14 17:02:26 +01:00

(svn r4038) -backport (3966, 3972 and 4019) -Fix: [OSX 10.3 and newer] [ 1157244 ] Can't save game if name contains german umlauts (loading savegames with certain chars still look a bit odd)

This commit is contained in:
bjarni
2006-03-22 21:40:26 +00:00
parent 90feff4982
commit a9032183df
6 changed files with 80 additions and 10 deletions

View File

@@ -1243,6 +1243,12 @@ extern bool AfterLoadGame(void);
extern void BeforeSaveGame(void);
extern bool LoadOldSaveGame(const char *file);
#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
extern const char *convert_to_fs_charset(const char *filename);
#else
#define convert_to_fs_charset(str) (str)
#endif
/** Small helper function to close the to be loaded savegame an signal error */
static inline SaveOrLoadResult AbortSaveLoad(void)
{
@@ -1347,7 +1353,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
@@ -1378,7 +1383,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) ("Cannot open savegame for saving/loading.");
return SL_ERROR;