equal
deleted
inserted
replaced
17 */ |
17 */ |
18 #include "stdafx.h" |
18 #include "stdafx.h" |
19 #include "openttd.h" |
19 #include "openttd.h" |
20 #include "debug.h" |
20 #include "debug.h" |
21 #include "functions.h" |
21 #include "functions.h" |
|
22 #include "hal.h" |
22 #include "vehicle.h" |
23 #include "vehicle.h" |
23 #include "station.h" |
24 #include "station.h" |
24 #include "thread.h" |
25 #include "thread.h" |
25 #include "town.h" |
26 #include "town.h" |
26 #include "player.h" |
27 #include "player.h" |
1312 void InitializeGame(int mode, uint size_x, uint size_y); |
1313 void InitializeGame(int mode, uint size_x, uint size_y); |
1313 extern bool AfterLoadGame(void); |
1314 extern bool AfterLoadGame(void); |
1314 extern void BeforeSaveGame(void); |
1315 extern void BeforeSaveGame(void); |
1315 extern bool LoadOldSaveGame(const char *file); |
1316 extern bool LoadOldSaveGame(const char *file); |
1316 |
1317 |
1317 #if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) |
|
1318 extern const char *convert_to_fs_charset(const char *filename); |
|
1319 #else |
|
1320 #define convert_to_fs_charset(str) (str) |
|
1321 #endif |
|
1322 |
|
1323 /** Small helper function to close the to be loaded savegame an signal error */ |
1318 /** Small helper function to close the to be loaded savegame an signal error */ |
1324 static inline SaveOrLoadResult AbortSaveLoad(void) |
1319 static inline SaveOrLoadResult AbortSaveLoad(void) |
1325 { |
1320 { |
1326 if (_sl.fh != NULL) fclose(_sl.fh); |
1321 if (_sl.fh != NULL) fclose(_sl.fh); |
1327 |
1322 |
1452 _sl_version = 0; |
1447 _sl_version = 0; |
1453 AfterLoadGame(); |
1448 AfterLoadGame(); |
1454 return SL_OK; |
1449 return SL_OK; |
1455 } |
1450 } |
1456 |
1451 |
1457 if(mode == SL_SAVE) { |
1452 _sl.fh = (mode == SL_SAVE) ? fopen(OTTD2FS(filename), "wb") : fopen(filename, "rb"); |
1458 _sl.fh = fopen(convert_to_fs_charset(filename), "wb"); |
|
1459 } else { |
|
1460 _sl.fh = fopen(filename, "rb"); |
|
1461 } |
|
1462 if (_sl.fh == NULL) { |
1453 if (_sl.fh == NULL) { |
1463 DEBUG(misc, 0) ("[Sl] Cannot open savegame for saving/loading."); |
1454 DEBUG(misc, 0) ("[Sl] Cannot open savegame for saving/loading."); |
1464 return SL_ERROR; |
1455 return SL_ERROR; |
1465 } |
1456 } |
1466 |
1457 |