equal
deleted
inserted
replaced
1005 } |
1005 } |
1006 return def; |
1006 return def; |
1007 } |
1007 } |
1008 |
1008 |
1009 // actual loader/saver function |
1009 // actual loader/saver function |
1010 extern void InitializeGame(void); |
1010 void InitializeGame(uint log_x, uint log_y); |
1011 extern bool AfterLoadGame(uint version); |
1011 extern bool AfterLoadGame(uint version); |
1012 extern void BeforeSaveGame(void); |
1012 extern void BeforeSaveGame(void); |
1013 extern bool LoadOldSaveGame(const char *file); |
1013 extern bool LoadOldSaveGame(const char *file); |
1014 |
1014 |
1015 // Save or Load files SL_LOAD, SL_SAVE, SL_OLD_LOAD |
1015 // Save or Load files SL_LOAD, SL_SAVE, SL_OLD_LOAD |
1019 const SaveLoadFormat *fmt; |
1019 const SaveLoadFormat *fmt; |
1020 uint version; |
1020 uint version; |
1021 |
1021 |
1022 // old style load |
1022 // old style load |
1023 if (mode == SL_OLD_LOAD) { |
1023 if (mode == SL_OLD_LOAD) { |
1024 InitializeGame(); |
1024 InitializeGame(8, 8); |
1025 if (!LoadOldSaveGame(filename)) return SL_REINIT; |
1025 if (!LoadOldSaveGame(filename)) return SL_REINIT; |
1026 AfterLoadGame(0); |
1026 AfterLoadGame(0); |
1027 return SL_OK; |
1027 return SL_OK; |
1028 } |
1028 } |
1029 |
1029 |
1124 return SL_ERROR; |
1124 return SL_ERROR; |
1125 } |
1125 } |
1126 |
1126 |
1127 if (!fmt->init_read()) goto init_err; |
1127 if (!fmt->init_read()) goto init_err; |
1128 // Clear everything |
1128 // Clear everything |
1129 InitializeGame(); |
1129 /* Set the current map to 256x256, in case of an old map. |
|
1130 * Else MAPS will read the right information */ |
|
1131 InitializeGame(8, 8); |
|
1132 |
1130 SlLoadChunks(); |
1133 SlLoadChunks(); |
1131 fmt->uninit_read(); |
1134 fmt->uninit_read(); |
1132 } |
1135 } |
1133 |
1136 |
1134 fclose(_sl.fh); |
1137 fclose(_sl.fh); |