(svn r26371) -Fix [FS#5831]: Calling DoCommandP during the gameloop cleared pending persistent storage changes.

This commit is contained in:
frosch
2014-02-23 22:03:08 +00:00
parent c6ce57e8a7
commit a32d18cbb9
6 changed files with 105 additions and 50 deletions

View File

@@ -105,6 +105,8 @@ static void _GenerateWorld(void *)
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
/* Must start economy early because of the costs. */
StartupEconomy();
@@ -141,8 +143,6 @@ static void _GenerateWorld(void *)
}
}
ClearPersistentStorageChanges(true);
/* These are probably pointless when inside the scenario editor. */
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
StartupCompanies();
@@ -179,6 +179,8 @@ static void _GenerateWorld(void *)
}
}
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
ResetObjectToPlace();
_cur_company.Trash();
_current_company = _local_company = _gw.lc;
@@ -202,6 +204,7 @@ static void _GenerateWorld(void *)
SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR, false);
}
} catch (...) {
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
if (_cur_company.IsValid()) _cur_company.Restore();
_generating_world = false;
_modal_progress_work_mutex->EndCritical();