summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-15 18:51:46 +0000
committerrubidium <rubidium@openttd.org>2008-01-15 18:51:46 +0000
commita3a5ff60571a062a358d496e5cd07c439fd4b16c (patch)
treecd46862cea14e32a966c0a3410d73ba666ef2ea4
parent736640fd87a6fd68a79a1d135f4a02b699135aa9 (diff)
downloadopenttd-a3a5ff60571a062a358d496e5cd07c439fd4b16c.tar.xz
(svn r11867) -Fix: do not reset changes to persistent storages during world generation.
-Fix: store changes to persistent storages after performing all the game logic instead of resetting them.
-rw-r--r--src/genworld.cpp3
-rw-r--r--src/openttd.cpp7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 27ea4fd4d..c6c15cc39 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -23,6 +23,7 @@
#include "core/random_func.hpp"
#include "engine.h"
#include "settings_type.h"
+#include "newgrf_storage.h"
#include "table/sprites.h"
@@ -118,6 +119,8 @@ static void *_GenerateWorld(void *arg)
}
}
+ ClearStorageChanges(true);
+
/* These are probably pointless when inside the scenario editor. */
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
StartupPlayers();
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 2ec5db868..2dfd6e050 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -974,8 +974,6 @@ void SwitchMode(int new_mode)
* That check is enforced in DoCommand. */
void StateGameLoop()
{
- ClearStorageChanges(false);
-
/* dont execute the state loop during pause */
if (_pause_game) {
CallWindowTickEvent();
@@ -983,10 +981,14 @@ void StateGameLoop()
}
if (IsGeneratingWorld()) return;
+ ClearStorageChanges(false);
+
if (_game_mode == GM_EDITOR) {
RunTileLoop();
CallVehicleTicks();
CallLandscapeTick();
+ ClearStorageChanges(true);
+
CallWindowTickEvent();
NewsLoop();
} else {
@@ -1000,6 +1002,7 @@ void StateGameLoop()
RunTileLoop();
CallVehicleTicks();
CallLandscapeTick();
+ ClearStorageChanges(true);
AI_RunGameLoop();