Index: src/settings.cpp =================================================================== --- src/settings.cpp (revision 13031) +++ src/settings.cpp (working copy) @@ -1889,7 +1889,7 @@ 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); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } return CommandCost(); @@ -1918,7 +1918,7 @@ Write_ValidateSetting(var2, sd, value); } if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); return true; } Index: src/settings_gui.cpp =================================================================== --- src/settings_gui.cpp (revision 13031) +++ src/settings_gui.cpp (working copy) @@ -290,7 +290,7 @@ case GAMEOPT_TOWNNAME_BTN: /* Town names */ if (_game_mode == GM_MENU) { _opt_ptr->town_name = e->we.dropdown.index; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindowClasses(WC_GAME_OPTIONS); } break; @@ -340,7 +340,7 @@ if (flags & DC_EXEC) { _opt_ptr->road_side = p1; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_GAMEOPTIONS); } return CommandCost(); } @@ -388,8 +388,8 @@ void ShowGameOptions() { - DeleteWindowById(WC_GAME_OPTIONS, 0); - new Window(&_game_options_desc); + DeleteWindowByClass(WC_GAME_OPTIONS); + new Window(&_game_options_desc, NULL, GOWN_GAMEOPTIONS); } struct GameSettingData { @@ -694,11 +694,11 @@ void ShowGameDifficulty() { - DeleteWindowById(WC_GAME_OPTIONS, 0); + DeleteWindowByClass(WC_GAME_OPTIONS); /* Copy current settings (ingame or in intro) to temporary holding place * change that when setting stuff, copy back on clicking 'OK' */ _opt_mod_temp = *_opt_ptr; - new Window(&_game_difficulty_desc); + new Window(&_game_difficulty_desc, NULL, GOWN_GAMEDIFFICULTY); } static const char *_patches_ui[] = { @@ -1103,8 +1103,8 @@ void ShowPatchesSelection() { - DeleteWindowById(WC_GAME_OPTIONS, 0); - new Window(&_patches_selection_desc); + DeleteWindowByClass(WC_GAME_OPTIONS); + new Window(&_patches_selection_desc, NULL, GOWN_CONFIGUREPATCHES); } Index: src/misc_gui.cpp =================================================================== --- src/misc_gui.cpp (revision 13031) +++ src/misc_gui.cpp (working copy) @@ -323,8 +323,8 @@ void ShowAboutWindow() { - DeleteWindowById(WC_GAME_OPTIONS, 0); - new Window(&_about_desc); + DeleteWindowByClass(WC_GAME_OPTIONS); + new Window(&_about_desc, NULL, GOWN_ABOUT); } static uint64 _errmsg_decode_params[20]; Index: src/newgrf_gui.cpp =================================================================== --- src/newgrf_gui.cpp (revision 13031) +++ src/newgrf_gui.cpp (working copy) @@ -211,7 +211,7 @@ *list = c; DeleteWindowByClass(WC_SAVELOAD); - InvalidateWindowData(WC_GAME_OPTIONS, 0); + InvalidateWindowData(WC_GAME_OPTIONS, GOWN_NEWGRFMANAGE); } break; @@ -583,7 +583,7 @@ Window *w; DeleteWindowByClass(WC_GAME_OPTIONS); - w = new Window(&_newgrf_desc); + w = new Window(&_newgrf_desc, NULL, GOWN_NEWGRFMANAGE); if (w == NULL) return; w->resize.step_height = 14; Index: src/window_type.h =================================================================== --- src/window_type.h (revision 13031) +++ src/window_type.h (working copy) @@ -71,7 +71,7 @@ WC_SEND_NETWORK_MSG, WC_DROPDOWN_MENU, WC_BUILD_INDUSTRY, - WC_GAME_OPTIONS, + WC_GAME_OPTIONS, ///< Game options. @see GameOptionsWindowNumber WC_NETWORK_WINDOW, WC_INDUSTRY_DIRECTORY, WC_MESSAGE_HISTORY, @@ -100,6 +100,17 @@ struct WindowEvent; typedef int32 WindowNumber; +/** Unique WindowNumber for each of the WC_GAME_OPTIONS windows */ +enum GameOptionsWindowNumber { + GOWN_GAMEOPTIONS, ///< Window number for the 'game options' window + GOWN_GAMEDIFFICULTY, ///< Window number for the 'game difficulty' window + GOWN_CONFIGUREPATCHES, ///< Window number for the 'configure patches' window + GOWN_ABOUT, ///< Window number for the 'about' window + GOWN_NEWSOPTIONS, ///< Window number for the 'news settings' window + GOWN_NEWGRFMANAGE ///< Window number for the 'manage NewGRF' window +}; + + /** * You cannot 100% reliably calculate the biggest custom struct as * the number of pointers in it and alignment will have a huge impact. Index: src/rail_gui.cpp =================================================================== --- src/rail_gui.cpp (revision 13031) +++ src/rail_gui.cpp (working copy) @@ -1328,14 +1328,14 @@ case BSW_DRAG_SIGNALS_DENSITY_DECREASE: if (_patches.drag_signals_density > 1) { _patches.drag_signals_density--; - SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } break; case BSW_DRAG_SIGNALS_DENSITY_INCREASE: if (_patches.drag_signals_density < 20) { _patches.drag_signals_density++; - SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } break; Index: src/news_gui.cpp =================================================================== --- src/news_gui.cpp (revision 13031) +++ src/news_gui.cpp (working copy) @@ -930,8 +930,8 @@ void ShowMessageOptions() { - DeleteWindowById(WC_GAME_OPTIONS, 0); - new Window(&_message_options_desc); + DeleteWindowByClass(WC_GAME_OPTIONS); + new Window(&_message_options_desc, NULL, GOWN_NEWSOPTIONS); } Index: src/players.cpp =================================================================== --- src/players.cpp (revision 13031) +++ src/players.cpp (working copy) @@ -68,7 +68,7 @@ _patches.autorenew = p->engine_renew; _patches.autorenew_months = p->engine_renew_months; _patches.autorenew_money = p->engine_renew_money; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } } @@ -693,7 +693,7 @@ p->engine_renew = HasBit(p2, 0); if (IsLocalPlayer()) { _patches.autorenew = p->engine_renew; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } } break; @@ -706,7 +706,7 @@ p->engine_renew_months = (int16)p2; if (IsLocalPlayer()) { _patches.autorenew_months = p->engine_renew_months; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } } break; @@ -719,7 +719,7 @@ p->engine_renew_money = p2; if (IsLocalPlayer()) { _patches.autorenew_money = p->engine_renew_money; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } } break; @@ -771,7 +771,7 @@ _patches.autorenew = p->engine_renew; _patches.autorenew_months = p->engine_renew_months; _patches.autorenew_money = p->engine_renew_money; - InvalidateWindow(WC_GAME_OPTIONS, 0); + InvalidateWindow(WC_GAME_OPTIONS, GOWN_CONFIGUREPATCHES); } } break; Index: src/misc_cmd.cpp =================================================================== --- src/misc_cmd.cpp (revision 13031) +++ src/misc_cmd.cpp (working copy) @@ -405,7 +405,7 @@ /* If we are a network-client, update the difficult setting (if it is open). * Use this instead of just dirtying the window because we need to load in * the new difficulty settings */ - if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) { + if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, GOWN_GAMEDIFFICULTY) != NULL) { ShowGameDifficulty(); } }