summaryrefslogtreecommitdiff
path: root/src/genworld.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-02-23 22:03:08 +0000
committerfrosch <frosch@openttd.org>2014-02-23 22:03:08 +0000
commita32d18cbb939b240bc16d909fce71ba72c24f040 (patch)
tree1cb4fa063b33b684a3a94fe60ade548dd7703624 /src/genworld.cpp
parentc6ce57e8a7529b970ef45eb7baa00560d6f4b16b (diff)
downloadopenttd-a32d18cbb939b240bc16d909fce71ba72c24f040.tar.xz
(svn r26371) -Fix [FS#5831]: Calling DoCommandP during the gameloop cleared pending persistent storage changes.
Diffstat (limited to 'src/genworld.cpp')
-rw-r--r--src/genworld.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index cb03db062..822fe141f 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -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();