diff options
author | smatz <smatz@openttd.org> | 2008-06-03 18:35:58 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-06-03 18:35:58 +0000 |
commit | c7a9637834a96722be5a524c4c1e8932a45e3461 (patch) | |
tree | 72b7d141fd63dcb880f610a334390bf9c41f97b1 /src/settings.cpp | |
parent | d58f0558761079552c4c607707dd131a2c5e5397 (diff) | |
download | openttd-c7a9637834a96722be5a524c4c1e8932a45e3461.tar.xz |
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 88596c9f1..b3cc06127 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -60,6 +60,7 @@ #include "sound/sound_driver.hpp" #include "music/music_driver.hpp" #include "blitter/factory.hpp" +#include "gamelog.h" #include "station_func.h" #include "table/strings.h" @@ -2128,8 +2129,20 @@ CommandCost CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint3 if (flags & DC_EXEC) { GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; void *var = GetVariableAddress(s, &sd->save); - Write_ValidateSetting(var, sd, (int32)p2); - if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); + + int32 oldval = (int32)ReadValue(var, sd->save.conv); + int32 newval = (int32)p2; + + Write_ValidateSetting(var, sd, newval); + newval = (int32)ReadValue(var, sd->save.conv); + + if (sd->desc.proc != NULL) sd->desc.proc(newval); + + if ((sd->desc.flags & SGF_NO_NETWORK) && oldval != newval) { + GamelogStartAction(GLAT_PATCH); + GamelogPatch(sd->desc.name, oldval, newval); + GamelogStopAction(); + } InvalidateWindow(WC_GAME_OPTIONS, 0); } |