equal
deleted
inserted
replaced
738 _game_mode = GM_NORMAL; |
738 _game_mode = GM_NORMAL; |
739 |
739 |
740 /* invalid type */ |
740 /* invalid type */ |
741 if (_file_to_saveload.mode == SL_INVALID) { |
741 if (_file_to_saveload.mode == SL_INVALID) { |
742 DEBUG(sl, 0, "Savegame is obsolete or invalid format: '%s'", _file_to_saveload.name); |
742 DEBUG(sl, 0, "Savegame is obsolete or invalid format: '%s'", _file_to_saveload.name); |
743 ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); |
743 SetDParamStr(0, GetSaveLoadErrorString()); |
|
744 ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); |
744 _game_mode = GM_MENU; |
745 _game_mode = GM_MENU; |
745 return; |
746 return; |
746 } |
747 } |
747 |
748 |
748 /* Reinitialize windows */ |
749 /* Reinitialize windows */ |
753 ResetGRFConfig(true); |
754 ResetGRFConfig(true); |
754 |
755 |
755 /* Load game */ |
756 /* Load game */ |
756 if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, SCENARIO_DIR) != SL_OK) { |
757 if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, SCENARIO_DIR) != SL_OK) { |
757 LoadIntroGame(); |
758 LoadIntroGame(); |
758 ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); |
759 SetDParamStr(0, GetSaveLoadErrorString()); |
|
760 ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); |
759 } |
761 } |
760 |
762 |
761 _opt_ptr = &_opt; |
763 _opt_ptr = &_opt; |
762 _opt_ptr->diff = _opt_newgame.diff; |
764 _opt_ptr->diff = _opt_newgame.diff; |
763 _opt.diff_level = _opt_newgame.diff_level; |
765 _opt.diff_level = _opt_newgame.diff_level; |
861 _opt_ptr = &_opt; |
863 _opt_ptr = &_opt; |
862 ResetGRFConfig(true); |
864 ResetGRFConfig(true); |
863 |
865 |
864 if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL, NO_DIRECTORY)) { |
866 if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL, NO_DIRECTORY)) { |
865 LoadIntroGame(); |
867 LoadIntroGame(); |
866 ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); |
868 SetDParamStr(0, GetSaveLoadErrorString()); |
|
869 ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); |
867 } else { |
870 } else { |
868 /* Update the local player for a loaded game. It is either always |
871 /* Update the local player for a loaded game. It is either always |
869 * player #1 (eg 0) or in the case of a dedicated server a spectator */ |
872 * player #1 (eg 0) or in the case of a dedicated server a spectator */ |
870 SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST); |
873 SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST); |
871 DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog) |
874 DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog) |
899 _opt_ptr = &_opt; |
902 _opt_ptr = &_opt; |
900 |
903 |
901 SetLocalPlayer(OWNER_NONE); |
904 SetLocalPlayer(OWNER_NONE); |
902 _patches_newgame.starting_year = _cur_year; |
905 _patches_newgame.starting_year = _cur_year; |
903 } else { |
906 } else { |
904 ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); |
907 SetDParamStr(0, GetSaveLoadErrorString()); |
|
908 ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); |
905 } |
909 } |
906 break; |
910 break; |
907 } |
911 } |
908 |
912 |
909 case SM_MENU: /* Switch to game intro menu */ |
913 case SM_MENU: /* Switch to game intro menu */ |
910 LoadIntroGame(); |
914 LoadIntroGame(); |
911 break; |
915 break; |
912 |
916 |
913 case SM_SAVE: /* Save game */ |
917 case SM_SAVE: /* Save game */ |
914 if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) { |
918 if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) { |
915 ShowErrorMessage(INVALID_STRING_ID, STR_4007_GAME_SAVE_FAILED, 0, 0); |
919 SetDParamStr(0, GetSaveLoadErrorString()); |
|
920 ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); |
916 } else { |
921 } else { |
917 DeleteWindowById(WC_SAVELOAD, 0); |
922 DeleteWindowById(WC_SAVELOAD, 0); |
918 } |
923 } |
919 break; |
924 break; |
920 |
925 |
1266 /* convert road side to my format. */ |
1271 /* convert road side to my format. */ |
1267 if (_opt.road_side) _opt.road_side = 1; |
1272 if (_opt.road_side) _opt.road_side = 1; |
1268 |
1273 |
1269 /* Check if all NewGRFs are present, we are very strict in MP mode */ |
1274 /* Check if all NewGRFs are present, we are very strict in MP mode */ |
1270 GRFListCompatibility gcf_res = IsGoodGRFConfigList(); |
1275 GRFListCompatibility gcf_res = IsGoodGRFConfigList(); |
1271 if (_networking && gcf_res != GLC_ALL_GOOD) return false; |
1276 if (_networking && gcf_res != GLC_ALL_GOOD) { |
|
1277 SetSaveLoadError(STR_NETWORK_ERR_CLIENT_NEWGRF_MISMATCH); |
|
1278 return false; |
|
1279 } |
1272 |
1280 |
1273 switch (gcf_res) { |
1281 switch (gcf_res) { |
1274 case GLC_COMPATIBLE: _switch_mode_errorstr = STR_NEWGRF_COMPATIBLE_LOAD_WARNING; break; |
1282 case GLC_COMPATIBLE: _switch_mode_errorstr = STR_NEWGRF_COMPATIBLE_LOAD_WARNING; break; |
1275 case GLC_NOT_FOUND: _switch_mode_errorstr = STR_NEWGRF_DISABLED_WARNING; break; |
1283 case GLC_NOT_FOUND: _switch_mode_errorstr = STR_NEWGRF_DISABLED_WARNING; break; |
1276 default: break; |
1284 default: break; |
1311 AfterLoadTown(); |
1319 AfterLoadTown(); |
1312 UpdateAllSignVirtCoords(); |
1320 UpdateAllSignVirtCoords(); |
1313 |
1321 |
1314 /* make sure there is a town in the game */ |
1322 /* make sure there is a town in the game */ |
1315 if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) { |
1323 if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) { |
1316 _error_message = STR_NO_TOWN_IN_SCENARIO; |
1324 SetSaveLoadError(STR_NO_TOWN_IN_SCENARIO); |
1317 return false; |
1325 return false; |
1318 } |
1326 } |
1319 |
1327 |
1320 /* Initialize windows */ |
1328 /* Initialize windows */ |
1321 ResetWindowSystem(); |
1329 ResetWindowSystem(); |