summaryrefslogtreecommitdiff
path: root/settings.c
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2006-11-17 10:42:20 +0000
committerKUDr <kudr@openttd.org>2006-11-17 10:42:20 +0000
commitd6b98584ab05ddf30b5e8b5e37a60bfca981c8dc (patch)
treed17ad6b6b7c13ec73d8fd079479346d21cbf28b7 /settings.c
parent590e90cd9e06df38d6136622efe79ad651b6300f (diff)
downloadopenttd-d6b98584ab05ddf30b5e8b5e37a60bfca981c8dc.tar.xz
(svn r7190) -Fix: If the non-player-based _patches setting was changed on the server during MP game, the callback function was:
1. Called only on the server but not on its clients. 2. Was called before the setting change occurred (usually with no effect) 3. Received old 'p1' argument value intead of new one It could cause some MP desyncs in the future.
Diffstat (limited to 'settings.c')
-rw-r--r--settings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/settings.c b/settings.c
index 86d73191c..6dea5e74a 100644
--- a/settings.c
+++ b/settings.c
@@ -1582,6 +1582,7 @@ int32 CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
void *var = ini_get_variable(&sd->save, patches_ptr);
Write_ValidateSetting(var, sd, (int32)p2);
+ if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
@@ -1611,6 +1612,7 @@ bool SetPatchValue(uint index, const Patches *object, int32 value)
void *var2 = ini_get_variable(&sd->save, &_patches_newgame);
Write_ValidateSetting(var2, sd, value);
}
+ if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
InvalidateWindow(WC_GAME_OPTIONS, 0);
return true;
}
@@ -1653,7 +1655,6 @@ bool IConsoleSetPatchSetting(const char *name, int32 value)
ptr = ini_get_variable(&sd->save, patches_ptr);
success = SetPatchValue(index, patches_ptr, value);
- if (success && sd->desc.proc != NULL) sd->desc.proc(value);
return success;
}