summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-07-02 12:58:37 +0000
committerfrosch <frosch@openttd.org>2011-07-02 12:58:37 +0000
commitc544dca5191112bf8a21acff36833c081d304291 (patch)
tree49342331be8f787edc274a11b3d987a814165be0 /src/settings_gui.cpp
parent1688470eb9b511990089eab1eec9f0ba3104d4c5 (diff)
downloadopenttd-c544dca5191112bf8a21acff36833c081d304291.tar.xz
(svn r22618) -Fix [FS#4653]: When changing difficulty settings over the network, do not just reopen the difficulty window if any game options window is opened; instead invalidate them properly.
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 55db5b102..7237574aa 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -659,9 +659,6 @@ public:
{
this->InitNested(desc);
- /* Copy current settings (ingame or in intro) to temporary holding place
- * change that when setting stuff, copy back on clicking 'OK' */
- this->opt_mod_temp = GetGameSettings();
/* Setup disabled buttons when creating window
* disable all other difficulty buttons during gameplay except for 'custom' */
this->SetWidgetsDisabledState(_game_mode != GM_MENU,
@@ -672,8 +669,9 @@ public:
WIDGET_LIST_END);
this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client)
- this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
- this->OnInvalidateData();
+
+ /* Read data */
+ this->OnInvalidateData(GOID_DIFFICULTY_CHANGED);
}
virtual void SetStringParameters(int widget) const
@@ -803,6 +801,17 @@ public:
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
+
+ if (data == GOID_DIFFICULTY_CHANGED) {
+ /* Window was created or settings were changed on server. Reread everything. */
+
+ /* Copy current settings (ingame or in intro) to temporary holding place
+ * change that when setting stuff, copy back on clicking 'OK' */
+ this->opt_mod_temp = GetGameSettings();
+
+ this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
+ }
+
uint i;
const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i);
for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) {