diff options
author | yexo <yexo@openttd.org> | 2010-05-21 06:59:45 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-05-21 06:59:45 +0000 |
commit | 9ed9aa9012fff20c9d73c5fa80e65e64c0925937 (patch) | |
tree | 210b679b8a15e4983c43e46df497e9e10edf8561 /src/genworld_gui.cpp | |
parent | 93233a9335aa26404405af54758e164bc0b96b41 (diff) | |
download | openttd-9ed9aa9012fff20c9d73c5fa80e65e64c0925937.tar.xz |
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
Diffstat (limited to 'src/genworld_gui.cpp')
-rw-r--r-- | src/genworld_gui.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 5efbe7271..ab3fa10c8 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -52,11 +52,11 @@ extern void MakeNewgameSettingsLive(); * Changes landscape type and sets genworld window dirty * @param landscape new landscape type */ -static inline void SetNewLandscapeType(byte landscape) +void SetNewLandscapeType(byte landscape) { _settings_newgame.game_creation.landscape = landscape; - SetWindowClassesDirty(WC_SELECT_GAME); - SetWindowClassesDirty(WC_GENERATE_LANDSCAPE); + InvalidateWindowClassesData(WC_SELECT_GAME); + InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE); } /** Widgets of GenerateLandscapeWindow */ @@ -363,6 +363,8 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { this->afilter = CS_NUMERAL; this->mode = (GenenerateLandscapeWindowMode)this->window_number; + + this->OnInvalidateData(); } @@ -400,6 +402,15 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } } + virtual void OnInvalidateData(int data = 0) + { + /* Update the climate buttons */ + this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(GLAND_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(GLAND_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); + } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { const StringID *strs = NULL; @@ -509,11 +520,6 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); - this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); - this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); - this->SetWidgetLoweredState(GLAND_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); - this->SetWidgetLoweredState(GLAND_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); - this->DrawWidgets(); this->DrawEditBox(GLAND_RANDOM_EDITBOX); |