(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.
This commit is contained in:
rubidium 2008-01-15 18:51:46 +00:00
parent 576f8ad93e
commit 6891bc2011
2 changed files with 8 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include "core/random_func.hpp" #include "core/random_func.hpp"
#include "engine.h" #include "engine.h"
#include "settings_type.h" #include "settings_type.h"
#include "newgrf_storage.h"
#include "table/sprites.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. */ /* These are probably pointless when inside the scenario editor. */
SetGeneratingWorldProgress(GWP_GAME_INIT, 3); SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
StartupPlayers(); StartupPlayers();

View File

@ -974,8 +974,6 @@ void SwitchMode(int new_mode)
* That check is enforced in DoCommand. */ * That check is enforced in DoCommand. */
void StateGameLoop() void StateGameLoop()
{ {
ClearStorageChanges(false);
/* dont execute the state loop during pause */ /* dont execute the state loop during pause */
if (_pause_game) { if (_pause_game) {
CallWindowTickEvent(); CallWindowTickEvent();
@ -983,10 +981,14 @@ void StateGameLoop()
} }
if (IsGeneratingWorld()) return; if (IsGeneratingWorld()) return;
ClearStorageChanges(false);
if (_game_mode == GM_EDITOR) { if (_game_mode == GM_EDITOR) {
RunTileLoop(); RunTileLoop();
CallVehicleTicks(); CallVehicleTicks();
CallLandscapeTick(); CallLandscapeTick();
ClearStorageChanges(true);
CallWindowTickEvent(); CallWindowTickEvent();
NewsLoop(); NewsLoop();
} else { } else {
@ -1000,6 +1002,7 @@ void StateGameLoop()
RunTileLoop(); RunTileLoop();
CallVehicleTicks(); CallVehicleTicks();
CallLandscapeTick(); CallLandscapeTick();
ClearStorageChanges(true);
AI_RunGameLoop(); AI_RunGameLoop();