diff options
author | frosch <frosch@openttd.org> | 2009-09-13 19:15:59 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-09-13 19:15:59 +0000 |
commit | ebd916be3def20902cf19ffd16555074728eb9c3 (patch) | |
tree | c7748d7612a61b9558ffd10ffb176e34584f2376 | |
parent | 5de9cc46b50b8e677395543c10b26b59c860212b (diff) | |
download | openttd-ebd916be3def20902cf19ffd16555074728eb9c3.tar.xz |
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
61 files changed, 323 insertions, 323 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index bdbcbea2a..b30865915 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -153,7 +153,7 @@ struct AIListWindow : public Window { for (int i = 0; i < this->selected; i++) it++; AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion()); } - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } virtual void OnClick(Point pt, int widget) @@ -767,7 +767,7 @@ struct AIDebugWindow : public Window { this->vscroll.SetCount(scroll_count); /* We need a repaint */ - this->InvalidateWidget(AID_WIDGET_SCROLLBAR); + this->SetWidgetDirty(AID_WIDGET_SCROLLBAR); } if (log == NULL) return; @@ -783,8 +783,8 @@ struct AIDebugWindow : public Window { this->vscroll.SetPosition(scroll_pos); /* We need a repaint */ - this->InvalidateWidget(AID_WIDGET_SCROLLBAR); - this->InvalidateWidget(AID_WIDGET_LOG_PANEL); + this->SetWidgetDirty(AID_WIDGET_SCROLLBAR); + this->SetWidgetDirty(AID_WIDGET_LOG_PANEL); } } this->last_vscroll_pos = this->vscroll.GetPosition(); diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 44d0b95c0..fbd9de204 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -433,7 +433,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0); - InvalidateWindow(WC_COMPANY, v->owner); + SetWindowDirty(WC_COMPANY, v->owner); if (IsLocalCompany()) InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window @@ -580,8 +580,8 @@ CommandCost CmdRefitAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin v->cargo_subtype = new_subtype; v->colourmap = PAL_NONE; // invalidate vehicle colour map v->InvalidateNewGRFCacheOfChain(); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0); } @@ -606,10 +606,10 @@ static void CheckIfAircraftNeedsService(Aircraft *v) // printf("targetairport = %d, st->index = %d\n", v->targetairport, st->index); // v->targetairport = st->index; v->current_order.MakeGoToDepot(st->index, ODTFB_SERVICE); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } else if (v->current_order.IsType(OT_GOTO_DEPOT)) { v->current_order.MakeDummy(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } @@ -639,8 +639,8 @@ void Aircraft::OnNewDay() SubtractMoneyFromCompanyFract(this->owner, cost); - InvalidateWindow(WC_VEHICLE_DETAILS, this->index); - InvalidateWindowClasses(WC_AIRCRAFT_LIST); + SetWindowDirty(WC_VEHICLE_DETAILS, this->index); + SetWindowClassesDirty(WC_AIRCRAFT_LIST); } static void HelicopterTickHandler(Aircraft *v) @@ -816,7 +816,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, if (spd != v->cur_speed) { v->cur_speed = spd; if (_settings_client.gui.vehicle_speed) - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } /* Adjust distance moved by plane speed setting */ @@ -1219,8 +1219,8 @@ static void HandleBrokenAircraft(Aircraft *v) if (v->breakdowns_since_last_service != 255) v->breakdowns_since_last_service++; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } } @@ -1316,7 +1316,7 @@ static void CrashAirplane(Aircraft *v) CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE); - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); uint amt = 2; if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count(); @@ -1439,7 +1439,7 @@ void AircraftLeaveHangar(Aircraft *v) VehicleServiceInDepot(v); SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindowClasses(WC_AIRCRAFT_LIST); + SetWindowClassesDirty(WC_AIRCRAFT_LIST); } /** Checks if an aircraft should head towards a hangar because it needs replacement @@ -1550,7 +1550,7 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass * v->date_of_last_service = _date; v->breakdowns_since_last_service = 0; v->reliability = Engine::Get(v->engine_type)->reliability; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } } return; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 590f6f48e..3e254292f 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -121,8 +121,8 @@ private: this->nested_array[BBSW_DROPDOWN_CRITERIA]->widget_data = this->sorter_names[this->bridges->SortType()]; /* Set the modified widgets dirty */ - this->InvalidateWidget(BBSW_DROPDOWN_CRITERIA); - this->InvalidateWidget(BBSW_BRIDGE_LIST); + this->SetWidgetDirty(BBSW_DROPDOWN_CRITERIA); + this->SetWidgetDirty(BBSW_BRIDGE_LIST); } public: diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index be5c99303..3ef1bf426 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -67,7 +67,7 @@ static int32 ClickChangeCompanyCheat(int32 p1, int32 p2) */ static int32 ClickSetProdCheat(int32 p1, int32 p2) { - InvalidateWindowClasses(WC_INDUSTRY_VIEW); + SetWindowClassesDirty(WC_INDUSTRY_VIEW); return p1; } @@ -104,7 +104,7 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2) SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day)); EnginesMonthlyLoop(); - InvalidateWindow(WC_STATUS_BAR, 0); + SetWindowDirty(WC_STATUS_BAR, 0); InvalidateWindowClassesData(WC_BUILD_STATION, 0); ResetSignalVariant(); return _cur_year; diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 9053fa987..97727a911 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -149,8 +149,8 @@ void InvalidateCompanyWindows(const Company *company) { CompanyID cid = company->index; - if (cid == _local_company) InvalidateWindow(WC_STATUS_BAR, 0); - InvalidateWindow(WC_FINANCES, cid); + if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0); + SetWindowDirty(WC_FINANCES, cid); } bool CheckCompanyHasMoney(CommandCost cost) @@ -459,9 +459,9 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY) GeneratePresidentName(c); - InvalidateWindow(WC_GRAPH_LEGEND, 0); - InvalidateWindow(WC_TOOLBAR_MENU, 0); - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_GRAPH_LEGEND, 0); + SetWindowDirty(WC_TOOLBAR_MENU, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index); @@ -595,7 +595,7 @@ void CompaniesYearlyLoop() FOR_ALL_COMPANIES(c) { memmove(&c->yearly_expenses[1], &c->yearly_expenses[0], sizeof(c->yearly_expenses) - sizeof(c->yearly_expenses[0])); memset(&c->yearly_expenses[0], 0, sizeof(c->yearly_expenses[0])); - InvalidateWindow(WC_FINANCES, c->index); + SetWindowDirty(WC_FINANCES, c->index); } if (_settings_client.gui.show_finances && _local_company != COMPANY_SPECTATOR) { diff --git a/src/company_gui.cpp b/src/company_gui.cpp index a87ac234e..3fac53cc4 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1665,7 +1665,7 @@ struct CompanyWindow : Window SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetTileSelectSize(2, 2); this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ); - this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ); + this->SetWidgetDirty(CW_WIDGET_BUILD_VIEW_HQ); } else { if (_ctrl_pressed) { ShowExtraViewPortWindow(tile); @@ -1680,7 +1680,7 @@ struct CompanyWindow : Window SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetTileSelectSize(2, 2); this->LowerWidget(CW_WIDGET_RELOCATE_HQ); - this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ); + this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ); break; case CW_WIDGET_BUY_SHARE: diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index a646793c0..b6f00c198 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -383,7 +383,7 @@ DEF_CONSOLE_CMD(ConClearBuffer) } IConsoleClearBuffer(); - InvalidateWindow(WC_CONSOLE, 0); + SetWindowDirty(WC_CONSOLE, 0); return true; } diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 7cde4e807..48f0f4905 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -141,7 +141,7 @@ static void IConsoleClearCommand() _iconsole_cmdline.width = 0; _iconsole_cmdline.caretpos = 0; _iconsole_cmdline.caretxoffs = 0; - InvalidateWindow(WC_CONSOLE, 0); + SetWindowDirty(WC_CONSOLE, 0); } static inline void IConsoleResetHistoryPos() {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} @@ -470,5 +470,5 @@ static void IConsoleHistoryNavigate(int direction) void IConsoleGUIPrint(ConsoleColour colour_code, char *str) { new IConsoleLine(str, (TextColour)colour_code); - InvalidateWindow(WC_CONSOLE, 0); + SetWindowDirty(WC_CONSOLE, 0); } diff --git a/src/date.cpp b/src/date.cpp index 714d0d699..4d3c27b2e 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -240,7 +240,7 @@ static void OnNewMonth() RedrawAutosave(); } - InvalidateWindowClasses(WC_CHEATS); + SetWindowClassesDirty(WC_CHEATS); CompaniesMonthlyLoop(); SubsidyMonthlyLoop(); EnginesMonthlyLoop(); @@ -264,7 +264,7 @@ static void OnNewDay() DisasterDailyLoop(); IndustryDailyLoop(); - InvalidateWindowWidget(WC_STATUS_BAR, 0, 0); + SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0); EnginesDailyLoop(); } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 6e756f91d..9dba83ad4 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -726,7 +726,7 @@ struct DepotWindow : Window { break; case DEPOT_WIDGET_CLONE: // Clone button - this->InvalidateWidget(DEPOT_WIDGET_CLONE); + this->SetWidgetDirty(DEPOT_WIDGET_CLONE); this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE); if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) { @@ -850,11 +850,11 @@ struct DepotWindow : Window { { /* abort clone */ this->RaiseWidget(DEPOT_WIDGET_CLONE); - this->InvalidateWidget(DEPOT_WIDGET_CLONE); + this->SetWidgetDirty(DEPOT_WIDGET_CLONE); /* abort drag & drop */ this->sel = INVALID_VEHICLE; - this->InvalidateWidget(DEPOT_WIDGET_MATRIX); + this->SetWidgetDirty(DEPOT_WIDGET_MATRIX); }; /* check if a vehicle in a depot was clicked.. */ @@ -935,11 +935,11 @@ struct DepotWindow : Window { { if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) { this->RaiseWidget(DEPOT_WIDGET_SELL); - this->InvalidateWidget(DEPOT_WIDGET_SELL); + this->SetWidgetDirty(DEPOT_WIDGET_SELL); } if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL_CHAIN)) { this->RaiseWidget(DEPOT_WIDGET_SELL_CHAIN); - this->InvalidateWidget(DEPOT_WIDGET_SELL_CHAIN); + this->SetWidgetDirty(DEPOT_WIDGET_SELL_CHAIN); } } @@ -955,7 +955,7 @@ struct DepotWindow : Window { { if (this->sel != INVALID_VEHICLE) { _cursor.vehchain = _ctrl_pressed; - this->InvalidateWidget(DEPOT_WIDGET_MATRIX); + this->SetWidgetDirty(DEPOT_WIDGET_MATRIX); return ES_HANDLED; } diff --git a/src/economy.cpp b/src/economy.cpp index a31595a7e..680727735 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -281,7 +281,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) c->old_economy[0].company_value = CalculateCompanyValue(c); } - InvalidateWindow(WC_PERFORMANCE_DETAIL, 0); + SetWindowDirty(WC_PERFORMANCE_DETAIL, 0); return score; } @@ -576,12 +576,12 @@ static void CompaniesGenStatistics() CompanyCheckBankrupt(c); } - InvalidateWindow(WC_INCOME_GRAPH, 0); - InvalidateWindow(WC_OPERATING_PROFIT, 0); - InvalidateWindow(WC_DELIVERED_CARGO, 0); - InvalidateWindow(WC_PERFORMANCE_HISTORY, 0); - InvalidateWindow(WC_COMPANY_VALUE, 0); - InvalidateWindow(WC_COMPANY_LEAGUE, 0); + SetWindowDirty(WC_INCOME_GRAPH, 0); + SetWindowDirty(WC_OPERATING_PROFIT, 0); + SetWindowDirty(WC_DELIVERED_CARGO, 0); + SetWindowDirty(WC_PERFORMANCE_HISTORY, 0); + SetWindowDirty(WC_COMPANY_VALUE, 0); + SetWindowDirty(WC_COMPANY_LEAGUE, 0); } /** @@ -670,10 +670,10 @@ void RecomputePrices() cs->current_payment = ((int64)cs->initial_payment * _economy.inflation_payment) >> 16; } - InvalidateWindowClasses(WC_BUILD_VEHICLE); - InvalidateWindowClasses(WC_REPLACE_VEHICLE); - InvalidateWindowClasses(WC_VEHICLE_DETAILS); - InvalidateWindow(WC_PAYMENT_RATES, 0); + SetWindowClassesDirty(WC_BUILD_VEHICLE); + SetWindowClassesDirty(WC_REPLACE_VEHICLE); + SetWindowClassesDirty(WC_VEHICLE_DETAILS); + SetWindowDirty(WC_PAYMENT_RATES, 0); } static void CompaniesPayInterest() @@ -966,7 +966,7 @@ static void TriggerIndustryProduction(Industry *i) if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) { IndustryProductionCallback(i, 0); } else { - InvalidateWindow(WC_INDUSTRY_VIEW, i->index); + SetWindowDirty(WC_INDUSTRY_VIEW, i->index); } } else { for (uint cargo_index = 0; cargo_index < lengthof(i->incoming_cargo_waiting); cargo_index++) { @@ -1354,13 +1354,13 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) } if (result != 0) { - InvalidateWindow(GetWindowClassForVehicleType(v->type), v->owner); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(GetWindowClassForVehicleType(v->type), v->owner); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); st->MarkTilesDirty(true); v->MarkDirty(); - if (result & 2) InvalidateWindow(WC_STATION_VIEW, last_visited); + if (result & 2) SetWindowDirty(WC_STATION_VIEW, last_visited); } } @@ -1495,7 +1495,7 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, break; } } - InvalidateWindow(WC_COMPANY, p1); + SetWindowDirty(WC_COMPANY, p1); } return cost; } @@ -1525,7 +1525,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1 OwnerByte *b = c->share_owners; while (*b != _current_company) b++; // share owners is guaranteed to contain company *b = COMPANY_SPECTATOR; - InvalidateWindow(WC_COMPANY, p1); + SetWindowDirty(WC_COMPANY, p1); } return CommandCost(EXPENSES_OTHER, cost); } diff --git a/src/engine.cpp b/src/engine.cpp index 392f3a587..09e0ad292 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -436,8 +436,8 @@ static void CalcEngineReliability(Engine *e) /* Kick this engine out of the lists */ AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); } - InvalidateWindowClasses(WC_BUILD_VEHICLE); // Update to show the new reliability - InvalidateWindowClasses(WC_REPLACE_VEHICLE); + SetWindowClassesDirty(WC_BUILD_VEHICLE); // Update to show the new reliability + SetWindowClassesDirty(WC_REPLACE_VEHICLE); } void SetYearEngineAgingStops() diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 76447ca70..db71ce835 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -54,8 +54,8 @@ extern void MakeNewgameSettingsLive(); static inline void SetNewLandscapeType(byte landscape) { _settings_newgame.game_creation.landscape = landscape; - InvalidateWindowClasses(WC_SELECT_GAME); - InvalidateWindowClasses(WC_GENERATE_LANDSCAPE); + SetWindowClassesDirty(WC_SELECT_GAME); + SetWindowClassesDirty(WC_GENERATE_LANDSCAPE); } enum GenerateLandscapeWindowWidgets { @@ -802,7 +802,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { if (this->IsWidgetLowered(*widget)) { this->RaiseWidget(*widget); - this->InvalidateWidget(*widget); + this->SetWidgetDirty(*widget); } } } @@ -880,12 +880,12 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { switch (this->widget_id) { case GLAND_START_DATE_TEXT: - this->InvalidateWidget(GLAND_START_DATE_TEXT); + this->SetWidgetDirty(GLAND_START_DATE_TEXT); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; case GLAND_SNOW_LEVEL_TEXT: - this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT); + this->SetWidgetDirty(GLAND_SNOW_LEVEL_TEXT); _settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT); break; @@ -936,7 +936,7 @@ static void _ShowGenerateLandscape(glwp_modes mode) strecpy(w->name, _file_to_saveload.title, lastof(w->name)); } - InvalidateWindow(WC_GENERATE_LANDSCAPE, mode); + SetWindowDirty(WC_GENERATE_LANDSCAPE, mode); } void ShowGenerateLandscape() @@ -1100,12 +1100,12 @@ struct CreateScenarioWindow : public Window switch (this->widget_id) { case CSCEN_START_DATE_TEXT: - this->InvalidateWidget(CSCEN_START_DATE_TEXT); + this->SetWidgetDirty(CSCEN_START_DATE_TEXT); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; case CSCEN_FLAT_LAND_HEIGHT_TEXT: - this->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT); + this->SetWidgetDirty(CSCEN_FLAT_LAND_HEIGHT_TEXT); _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT); break; } @@ -1396,7 +1396,7 @@ static void _SetGeneratingWorldProgress(gwp_class cls, uint progress, uint total return; } - InvalidateWindow(WC_GENERATE_PROGRESS_WINDOW, 0); + SetWindowDirty(WC_GENERATE_PROGRESS_WINDOW, 0); MarkWholeScreenDirty(); /* Release the rights to the map generator, and acquire the rights to the diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index a77a44460..5cb2aa381 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -87,11 +87,11 @@ struct GraphLegendWindow : Window { ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY); this->ToggleWidgetLoweredState(widget); this->SetDirty(); - InvalidateWindow(WC_INCOME_GRAPH, 0); - InvalidateWindow(WC_OPERATING_PROFIT, 0); - InvalidateWindow(WC_DELIVERED_CARGO, 0); - InvalidateWindow(WC_PERFORMANCE_HISTORY, 0); - InvalidateWindow(WC_COMPANY_VALUE, 0); + SetWindowDirty(WC_INCOME_GRAPH, 0); + SetWindowDirty(WC_OPERATING_PROFIT, 0); + SetWindowDirty(WC_DELIVERED_CARGO, 0); + SetWindowDirty(WC_PERFORMANCE_HISTORY, 0); + SetWindowDirty(WC_COMPANY_VALUE, 0); } virtual void OnInvalidateData(int data) @@ -403,7 +403,7 @@ protected: Window(desc, window_number), has_negative_values(has_negative_values), format_str_y_axis(format_str_y_axis) { - InvalidateWindow(WC_GRAPH_LEGEND, 0); + SetWindowDirty(WC_GRAPH_LEGEND, 0); this->num_vert_lines = 24; this->graph_location.left = left; diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index 61875e1b7..69f39cca3 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -228,7 +228,7 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u } /* Update the Replace Vehicle Windows */ - InvalidateWindow(WC_REPLACE_VEHICLE, v->type); + SetWindowDirty(WC_REPLACE_VEHICLE, v->type); InvalidateWindowData(GetWindowClassForVehicleType(v->type), (v->type << 11) | VLW_GROUP_LIST | _current_company); } @@ -362,7 +362,7 @@ void SetTrainGroupID(Train *v, GroupID new_g) } /* Update the Replace Vehicle Windows */ - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN); + SetWindowDirty(WC_REPLACE_VEHICLE, VEH_TRAIN); } @@ -385,7 +385,7 @@ void UpdateTrainGroupID(Train *v) } /* Update the Replace Vehicle Windows */ - InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN); + SetWindowDirty(WC_REPLACE_VEHICLE, VEH_TRAIN); } uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 6287377d0..8c31e4714 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -676,7 +676,7 @@ public: { /* abort drag & drop */ this->vehicle_sel = INVALID_VEHICLE; - this->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE); + this->SetWidgetDirty(GRP_WIDGET_LIST_VEHICLE); } void ShowRenameGroupWindow(GroupID group) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index b31b82e3f..84a2609e1 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1894,7 +1894,7 @@ static void UpdateIndustryStatistics(Industry *i) } } - if (refresh) InvalidateWindow(WC_INDUSTRY_VIEW, i->index); + if (refresh) SetWindowDirty(WC_INDUSTRY_VIEW, i->index); } /** Simple helper that will collect data for the generation of industries */ diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index f64be7deb..53981ab48 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -806,7 +806,7 @@ protected: if (!this->industries.Sort()) return; IndustryDirectoryWindow::last_industry = NULL; // Reset name sorter sort cache - this->InvalidateWidget(IDW_INDUSTRY_LIST); // Set the modified widget dirty + this->SetWidgetDirty(IDW_INDUSTRY_LIST); // Set the modified widget dirty } /** diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 7d36abee6..47dbd1f11 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -35,7 +35,7 @@ static inline void SetNewLandscapeType(byte landscape) { _settings_newgame.game_creation.landscape = landscape; - InvalidateWindowClasses(WC_SELECT_GAME); + SetWindowClassesDirty(WC_SELECT_GAME); } enum SelectGameIntroWidgets { diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 192fe4e72..a3428d356 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -354,8 +354,8 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, } } - InvalidateWindow(WC_STATUS_BAR, 0); - InvalidateWindow(WC_MAIN_TOOLBAR, 0); + SetWindowDirty(WC_STATUS_BAR, 0); + SetWindowDirty(WC_MAIN_TOOLBAR, 0); } return CommandCost(); } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 7a4c7f015..2537677d7 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1141,25 +1141,25 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key case WKC_RETURN: case WKC_NUM_ENTER: return HEBR_CONFIRM; case (WKC_CTRL | 'V'): - if (InsertTextBufferClipboard(&this->text)) w->InvalidateWidget(wid); + if (InsertTextBufferClipboard(&this->text)) w->SetWidgetDirty(wid); break; case (WKC_CTRL | 'U'): DeleteTextBufferAll(&this->text); - w->InvalidateWidget(wid); + w->SetWidgetDirty(wid); break; case WKC_BACKSPACE: case WKC_DELETE: - if (DeleteTextBufferChar(&this->text, keycode)) w->InvalidateWidget(wid); + if (DeleteTextBufferChar(&this->text, keycode)) w->SetWidgetDirty(wid); break; case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: - if (MoveTextBufferPos(&this->text, keycode)) w->InvalidateWidget(wid); + if (MoveTextBufferPos(&this->text, keycode)) w->SetWidgetDirty(wid); break; default: if (IsValidChar(key, this->afilter)) { - if (InsertTextBufferChar(&this->text, key)) w->InvalidateWidget(wid); + if (InsertTextBufferChar(&this->text, key)) w->SetWidgetDirty(wid); } else { state = Window::ES_NOT_HANDLED; } @@ -1171,7 +1171,7 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key void QueryString::HandleEditBox(Window *w, int wid) { if (HasEditBoxFocus(w, wid) && HandleCaret(&this->text)) { - w->InvalidateWidget(wid); + w->SetWidgetDirty(wid); /* When we're not the OSK, notify 'our' OSK to redraw the widget, * so the caret changes appropriately. */ if (w->window_class != WC_OSK) { @@ -1932,7 +1932,7 @@ public: /* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */ ttd_strlcpy(this->text.buf, file->title, this->text.maxsize); UpdateTextBufferSize(&this->text); - this->InvalidateWidget(SLWW_SAVE_OSK_TITLE); + this->SetWidgetDirty(SLWW_SAVE_OSK_TITLE); } } else { /* Changed directory, need repaint. */ @@ -2078,7 +2078,7 @@ void ShowSaveLoadDialog(SaveLoadDialogMode mode) void RedrawAutosave() { - InvalidateWindow(WC_STATUS_BAR, 0); + SetWindowDirty(WC_STATUS_BAR, 0); } void SetFiosType(const byte fiostype) diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 148bb2ec0..802b5137c 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -148,7 +148,7 @@ static void StopMusic() _music_wnd_cursong = 0; DoStopMusic(); _song_is_active = false; - InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9); + SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9); } static void PlayPlaylistSong() @@ -169,7 +169,7 @@ static void PlayPlaylistSong() DoPlaySong(); _song_is_active = true; - InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9); + SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9); } void ResetMusic() @@ -600,7 +600,7 @@ struct MusicWindow : public Window { case MW_SHUFFLE: // toggle shuffle msf.shuffle ^= 1; this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle); - this->InvalidateWidget(MW_SHUFFLE); + this->SetWidgetDirty(MW_SHUFFLE); StopMusic(); SelectSongToPlay(); this->SetDirty(); @@ -623,7 +623,7 @@ struct MusicWindow : public Window { #if 0 virtual void OnTick() { - this->InvalidateWidget(MW_GAUGE); + this->SetWidgetDirty(MW_GAUGE); } #endif }; diff --git a/src/network/network.cpp b/src/network/network.cpp index e4e21f1d9..70bfb1678 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -441,7 +441,7 @@ static NetworkClientSocket *NetworkAllocClient(SOCKET s) ci->client_playas = COMPANY_INACTIVE_CLIENT; ci->join_date = _date; - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); } return cs; @@ -489,7 +489,7 @@ void NetworkCloseClient(NetworkClientSocket *cs, bool error) if (cs->status >= STATUS_AUTH) _network_game_info.clients_on--; _network_clients_connected--; - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); } delete cs->GetInfo(); diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 850619ec1..f1c7e7d1a 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -124,7 +124,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_COMPANY_INFO) */ Packet *p; _network_join_status = NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO; - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); p = NetworkSend_Init(PACKET_CLIENT_COMPANY_INFO); MY_CLIENT->Send_Packet(p); @@ -145,7 +145,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN) Packet *p; _network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING; - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); p = NetworkSend_Init(PACKET_CLIENT_JOIN); p->Send_string(_openttd_revision); @@ -399,7 +399,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO) p->Recv_string(company_info->clients, sizeof(company_info->clients)); - InvalidateWindow(WC_NETWORK_WINDOW, 0); + SetWindowDirty(WC_NETWORK_WINDOW, 0); return NETWORK_RECV_STATUS_OKAY; } @@ -434,7 +434,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO) ci->client_playas = playas; strecpy(ci->client_name, name, lastof(ci->client_name)); - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); return NETWORK_RECV_STATUS_OKAY; } @@ -446,7 +446,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO) strecpy(ci->client_name, name, lastof(ci->client_name)); - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); return NETWORK_RECV_STATUS_OKAY; } @@ -560,7 +560,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_WAIT) { _network_join_status = NETWORK_JOIN_STATUS_WAITING; _network_join_waiting = p->Recv_uint8(); - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); /* We are put on hold for receiving the map.. we need GUI for this ;) */ DEBUG(net, 1, "The server is currently busy sending the map to someone else, please wait..." ); @@ -601,7 +601,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) if (_network_join_bytes_total == 0) return NETWORK_RECV_STATUS_MALFORMED_PACKET; _network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING; - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); /* The first packet does not contain any more data */ return NETWORK_RECV_STATUS_OKAY; @@ -615,7 +615,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) } _network_join_bytes = ftell(file_pointer); - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); } /* Check if this was the last packet */ @@ -623,7 +623,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) fclose(file_pointer); _network_join_status = NETWORK_JOIN_STATUS_PROCESSING; - InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0); + SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); /* The map is done downloading, load it */ if (!SafeSaveOrLoad("network_client.tmp", SL_LOAD, GM_NORMAL, AUTOSAVE_DIR)) { @@ -775,7 +775,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR_QUIT) delete ci; } - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); return NETWORK_RECV_STATUS_OKAY; } @@ -794,7 +794,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_QUIT) DEBUG(net, 0, "Unknown client (%d) is leaving the game", client_id); } - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); /* If we come here it means we could not locate the client.. strange :s */ return NETWORK_RECV_STATUS_OKAY; @@ -808,7 +808,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_JOIN) if (ci != NULL) NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, ci->client_name); - InvalidateWindow(WC_CLIENT_LIST, 0); + SetWindowDirty(WC_CLIENT_LIST, 0); return NETWORK_RECV_STATUS_OKAY; } @@ -881,7 +881,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CONFIG_UPDATE) DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_UPDATE) { _network_company_passworded = p->Recv_uint16(); - InvalidateWindowClasses(WC_COMPANY); + SetWindowClassesDirty(WC_COMPANY); return NETWORK_RECV_STATUS_OKAY; } diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 562fdcea7..3838b186d 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -95,17 +95,17 @@ public: case CONTENT_TYPE_AI: case CONTENT_TYPE_AI_LIBRARY: AI::Rescan(); - InvalidateWindowClasses(WC_AI_DEBUG); + SetWindowClassesDirty(WC_AI_DEBUG); break; case CONTENT_TYPE_BASE_GRAPHICS: BaseGraphics::FindSets(); - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); break; case CONTENT_TYPE_BASE_SOUNDS: BaseSounds::FindSets(); - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); break; case CONTENT_TYPE_NEWGRF: diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index eae555130..01679d829 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1203,7 +1203,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password)); } else { int32 value = atoi(str); - this->InvalidateWidget(this->widget_id); + this->SetWidgetDirty(this->widget_id); switch (this->widget_id) { default: NOT_REACHED(); case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 33f7f4df9..4f867a401 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1733,7 +1733,7 @@ void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded) if (NetworkCompanyIsPassworded(company_id) == passworded) return; SB(_network_company_passworded, company_id, 1, !!passworded); - InvalidateWindowClasses(WC_COMPANY); + SetWindowClassesDirty(WC_COMPANY); NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index e2916d00d..25a4da20e 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -557,5 +557,5 @@ void IndustryProductionCallback(Industry *ind, int reason) SB(object.callback_param2, 24, 8, again); } - InvalidateWindow(WC_INDUSTRY_VIEW, ind->index); + SetWindowDirty(WC_INDUSTRY_VIEW, ind->index); } diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 455c16907..8c3c50afa 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -690,7 +690,7 @@ void AddNewsItem(StringID string, NewsSubtype subtype, NewsReferenceType reftype ni->next = NULL; _latest_news = ni; - InvalidateWindow(WC_MESSAGE_HISTORY, 0); + SetWindowDirty(WC_MESSAGE_HISTORY, 0); } /** Delete a news item from the queue */ @@ -724,7 +724,7 @@ static void DeleteNewsItem(NewsItem *ni) _total_news--; delete ni; - InvalidateWindow(WC_MESSAGE_HISTORY, 0); + SetWindowDirty(WC_MESSAGE_HISTORY, 0); } void DeleteVehicleNews(VehicleID vid, StringID news) @@ -1160,7 +1160,7 @@ struct MessageOptionsWindow : Window { case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off _news_ticker_sound ^= 1; this->OnInvalidateData(0); - this->InvalidateWidget(widget); + this->SetWidgetDirty(widget); break; default: { // Clicked on the [<] .. [>] widgets diff --git a/src/openttd.cpp b/src/openttd.cpp index 6297edacf..1391c7d95 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -602,7 +602,7 @@ int ttd_main(int argc, char *argv[]) /* Initialize FreeType */ InitFreeType(); - /* This must be done early, since functions use the InvalidateWindow* calls */ + /* This must be done early, since functions use the SetWindowDirty* calls */ InitWindowSystem(); /* Look for the sounds before the graphics. Otherwise none would be set and diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 8eb7f7e97..2b0c09e5d 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -179,7 +179,7 @@ Order::Order(uint32 packed) */ void InvalidateVehicleOrder(const Vehicle *v, int data) { - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); if (data != 0) { /* Calls SetDirty() too */ @@ -188,8 +188,8 @@ void InvalidateVehicleOrder(const Vehicle *v, int data) return; } - InvalidateWindow(WC_VEHICLE_ORDERS, v->index); - InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index); + SetWindowDirty(WC_VEHICLE_ORDERS, v->index); + SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); } /** @@ -795,8 +795,8 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 } /* We have an aircraft/ship, they have a mini-schedule, so update them all */ - if (v->type == VEH_AIRCRAFT) InvalidateWindowClasses(WC_AIRCRAFT_LIST); - if (v->type == VEH_SHIP) InvalidateWindowClasses(WC_SHIPS_LIST); + if (v->type == VEH_AIRCRAFT) SetWindowClassesDirty(WC_AIRCRAFT_LIST); + if (v->type == VEH_SHIP) SetWindowClassesDirty(WC_SHIPS_LIST); return CommandCost(); } @@ -1515,7 +1515,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination) if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type && v->current_order.GetDestination() == destination) { order->MakeDummy(); - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); } /* Clear the order from the order-list */ @@ -1806,7 +1806,7 @@ bool ProcessOrders(Vehicle *v) case VEH_AIRCRAFT: case VEH_SHIP: - InvalidateWindowClasses(GetWindowClassForVehicleType(v->type)); + SetWindowClassesDirty(GetWindowClassForVehicleType(v->type)); break; } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 7783931ce..00b5843dd 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -456,7 +456,7 @@ private: */ void OrderClick_Goto(int i) { - this->InvalidateWidget(ORDER_WIDGET_GOTO); + this->SetWidgetDirty(ORDER_WIDGET_GOTO); this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) { _place_clicked_vehicle = NULL; @@ -521,7 +521,7 @@ private: */ void OrderClick_Conditional(int i) { - this->InvalidateWidget(ORDER_WIDGET_GOTO); + this->SetWidgetDirty(ORDER_WIDGET_GOTO); this->LowerWidget(ORDER_WIDGET_GOTO); SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this); this->goto_type = OPOS_CONDITIONAL; @@ -560,7 +560,7 @@ private: non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS; } - this->InvalidateWidget(ORDER_WIDGET_NON_STOP); + this->SetWidgetDirty(ORDER_WIDGET_NON_STOP); DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); } @@ -1138,7 +1138,7 @@ public: } } this->RaiseWidget(ORDER_WIDGET_GOTO); - this->InvalidateWidget(ORDER_WIDGET_GOTO); + this->SetWidgetDirty(ORDER_WIDGET_GOTO); } virtual void OnMouseLoop() @@ -1233,7 +1233,7 @@ public: for (uint i = 0; i < this->widget_count; i++) { if (this->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { this->RaiseWidget(i); - this->InvalidateWidget(i); + this->SetWidgetDirty(i); } } } diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 4aa4285f7..cb411391f 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -245,20 +245,20 @@ struct OskWindow : public Window { QueryStringBaseWindow *w = dynamic_cast<QueryStringBaseWindow*>(this->parent); if (w != NULL) w->OnOSKInput(this->text_btn); - this->InvalidateWidget(OSK_WIDGET_TEXT); - if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); + this->SetWidgetDirty(OSK_WIDGET_TEXT); + if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn); } virtual void OnMouseLoop() { this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); /* make the caret of the parent window also blink */ - this->parent->InvalidateWidget(this->text_btn); + this->parent->SetWidgetDirty(this->text_btn); } virtual void OnInvalidateData(int) { - this->InvalidateWidget(OSK_WIDGET_TEXT); + this->SetWidgetDirty(OSK_WIDGET_TEXT); } }; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 3d29c624f..9574683bb 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -314,7 +314,7 @@ static void ToggleRailButton_Remove(Window *w) { DeleteWindowById(WC_SELECT_STATION, 0); w->ToggleWidgetLoweredState(RTW_REMOVE); - w->InvalidateWidget(RTW_REMOVE); + w->SetWidgetDirty(RTW_REMOVE); _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); SetSelectionRed(_remove_button_clicked); } @@ -795,7 +795,7 @@ struct BuildRailToolbarWindow : Window { { this->RaiseButtons(); this->DisableWidget(RTW_REMOVE); - this->InvalidateWidget(RTW_REMOVE); + this->SetWidgetDirty(RTW_REMOVE); DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); @@ -1601,14 +1601,14 @@ public: case BSW_DRAG_SIGNALS_DENSITY_DECREASE: if (_settings_client.gui.drag_signals_density > 1) { _settings_client.gui.drag_signals_density--; - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } break; case BSW_DRAG_SIGNALS_DENSITY_INCREASE: if (_settings_client.gui.drag_signals_density < 20) { _settings_client.gui.drag_signals_density++; - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } break; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 90a26d97f..e7a06b8f3 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -267,7 +267,7 @@ typedef void OnButtonClick(Window *w); static void ToggleRoadButton_Remove(Window *w) { w->ToggleWidgetLoweredState(RTW_REMOVE); - w->InvalidateWidget(RTW_REMOVE); + w->SetWidgetDirty(RTW_REMOVE); _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); SetSelectionRed(_remove_button_clicked); } @@ -447,12 +447,12 @@ struct BuildRoadToolbarWindow : Window { switch (clicked_widget) { case RTW_REMOVE: this->RaiseWidget(RTW_ONE_WAY); - this->InvalidateWidget(RTW_ONE_WAY); + this->SetWidgetDirty(RTW_ONE_WAY); break; case RTW_ONE_WAY: this->RaiseWidget(RTW_REMOVE); - this->InvalidateWidget(RTW_REMOVE); + this->SetWidgetDirty(RTW_REMOVE); break; case RTW_BUS_STATION: @@ -533,8 +533,8 @@ struct BuildRoadToolbarWindow : Window { RTW_REMOVE, RTW_ONE_WAY, WIDGET_LIST_END); - this->InvalidateWidget(RTW_REMOVE); - this->InvalidateWidget(RTW_ONE_WAY); + this->SetWidgetDirty(RTW_REMOVE); + this->SetWidgetDirty(RTW_ONE_WAY); DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 8bafe33ce..2cf5fd8e7 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -295,7 +295,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_ROADVEH_LIST, 0); - InvalidateWindow(WC_COMPANY, v->owner); + SetWindowDirty(WC_COMPANY, v->owner); if (IsLocalCompany()) { InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window } @@ -620,7 +620,7 @@ static void RoadVehCrash(RoadVehicle *v) ClearSlot(v); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING)); @@ -663,8 +663,8 @@ static void HandleBrokenRoadVeh(RoadVehicle *v) if (v->breakdowns_since_last_service != 255) v->breakdowns_since_last_service++; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? @@ -680,7 +680,7 @@ static void HandleBrokenRoadVeh(RoadVehicle *v) if ((v->tick_counter & 1) == 0) { if (--v->breakdown_delay == 0) { v->breakdown_ctr = 0; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); } } } @@ -836,7 +836,7 @@ static int RoadVehAccelerate(RoadVehicle *v) /* Update statusbar only if speed has changed to save CPU time */ if (oldspeed != v->cur_speed) { if (_settings_client.gui.vehicle_speed) { - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } @@ -1730,7 +1730,7 @@ again: } StartRoadVehSound(v); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } /* Check tile position conditions - i.e. stop position in depot, @@ -1845,7 +1845,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v) * suddenly moved farther away, we continue our normal * schedule? */ v->current_order.MakeDummy(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } return; } @@ -1863,7 +1863,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v) v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE); v->dest_tile = rfdd.tile; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } void RoadVehicle::OnNewDay() @@ -1957,8 +1957,8 @@ void RoadVehicle::OnNewDay() SubtractMoneyFromCompanyFract(this->owner, cost); - InvalidateWindow(WC_VEHICLE_DETAILS, this->index); - InvalidateWindowClasses(WC_ROADVEH_LIST); + SetWindowDirty(WC_VEHICLE_DETAILS, this->index); + SetWindowClassesDirty(WC_ROADVEH_LIST); } Trackdir RoadVehicle::GetVehicleTrackdir() const @@ -2069,8 +2069,8 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0); v->cargo_type = new_cid; v->cargo_subtype = new_subtype; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_ROADVEH_LIST, 0); } } diff --git a/src/settings.cpp b/src/settings.cpp index fa30c8a7a..61b58d354 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -664,13 +664,13 @@ static bool RedrawScreen(int32 p1) static bool InvalidateDetailsWindow(int32 p1) { - InvalidateWindowClasses(WC_VEHICLE_DETAILS); + SetWindowClassesDirty(WC_VEHICLE_DETAILS); return true; } static bool InvalidateStationBuildWindow(int32 p1) { - InvalidateWindow(WC_BUILD_STATION, 0); + SetWindowDirty(WC_BUILD_STATION, 0); return true; } @@ -752,7 +752,7 @@ static bool TrainAccelerationModelChanged(int32 p1) static bool DragSignalsDensityChanged(int32) { - InvalidateWindow(WC_BUILD_SIGNAL, 0); + SetWindowDirty(WC_BUILD_SIGNAL, 0); return true; } @@ -820,7 +820,7 @@ static bool DifficultyChange(int32) ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0); _settings_newgame.difficulty.diff_level = 3; } - InvalidateWindowClasses(WC_SELECT_GAME); + SetWindowClassesDirty(WC_SELECT_GAME); } else { _settings_game.difficulty.diff_level = 3; } @@ -1446,7 +1446,7 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin GamelogStopAction(); } - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } return CommandCost(); @@ -1480,7 +1480,7 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32 return CommandCost(); } - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } return CommandCost(); @@ -1509,7 +1509,7 @@ bool SetSettingValue(uint index, int32 value) Write_ValidateSetting(var2, sd, value); } if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); return true; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 9610b833a..b253a2017 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -384,7 +384,7 @@ struct GameOptionsWindow : Window { case GOW_TOWNNAME_DROPDOWN: // Town names if (_game_mode == GM_MENU || Town::GetNumItems() == 0) { this->opt->game_creation.town_name = index; - InvalidateWindow(WC_GAME_OPTIONS, 0); + SetWindowDirty(WC_GAME_OPTIONS, 0); } break; diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 5b1e005fe..a88d4f429 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -146,14 +146,14 @@ static void CheckIfShipNeedsService(Vehicle *v) if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { if (v->current_order.IsType(OT_GOTO_DEPOT)) { v->current_order.MakeDummy(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } return; } v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE); v->dest_tile = depot->xy; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } Money Ship::GetRunningCost() const @@ -181,9 +181,9 @@ void Ship::OnNewDay() SubtractMoneyFromCompanyFract(this->owner, cost); - InvalidateWindow(WC_VEHICLE_DETAILS, this->index); + SetWindowDirty(WC_VEHICLE_DETAILS, this->index); /* we need this for the profit */ - InvalidateWindowClasses(WC_SHIPS_LIST); + SetWindowClassesDirty(WC_SHIPS_LIST); } Trackdir Ship::GetVehicleTrackdir() const @@ -212,8 +212,8 @@ static void HandleBrokenShip(Vehicle *v) if (v->breakdowns_since_last_service != 255) v->breakdowns_since_last_service++; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? @@ -229,7 +229,7 @@ static void HandleBrokenShip(Vehicle *v) if (!(v->tick_counter & 1)) { if (!--v->breakdown_delay) { v->breakdown_ctr = 0; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); } } } @@ -290,7 +290,7 @@ void Ship::UpdateDeltaXY(Direction direction) void RecalcShipStuff(Vehicle *v) { v->UpdateViewport(false, true); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); } static const TileIndexDiffC _ship_leave_depot_offs[] = { @@ -324,7 +324,7 @@ static void CheckShipLeaveDepot(Ship *v) PlayShipSound(v); VehicleServiceInDepot(v); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindowClasses(WC_SHIPS_LIST); + SetWindowClassesDirty(WC_SHIPS_LIST); } static bool ShipAccelerate(Vehicle *v) @@ -338,7 +338,7 @@ static bool ShipAccelerate(Vehicle *v) if (spd != v->cur_speed) { v->cur_speed = spd; if (_settings_client.gui.vehicle_speed) - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } /* Decrease somewhat when turning */ @@ -627,7 +627,7 @@ static void ShipController(Ship *v) * always skip ahead. */ if (v->current_order.IsType(OT_LEAVESTATION)) { v->current_order.Free(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } else if (v->dest_tile != 0) { /* We have a target, let's see if we reached it... */ if (v->current_order.IsType(OT_GOTO_WAYPOINT) && @@ -819,7 +819,7 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_SHIPS_LIST, 0); - InvalidateWindow(WC_COMPANY, v->owner); + SetWindowDirty(WC_COMPANY, v->owner); if (IsLocalCompany()) InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window @@ -948,8 +948,8 @@ CommandCost CmdRefitShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 v->cargo_subtype = new_subtype; v->colourmap = PAL_NONE; // invalidate vehicle colour map v->InvalidateNewGRFCacheOfChain(); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_SHIPS_LIST, 0); } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 830cc6e17..798568f14 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -176,7 +176,7 @@ struct SignListWindow : Window, SignList { if (data == 0) { // New or deleted sign. this->signs.ForceRebuild(); this->BuildSignsList(); - this->InvalidateWidget(SLW_CAPTION); + this->SetWidgetDirty(SLW_CAPTION); this->vscroll.SetCount(this->signs.Length()); } else { // Change of sign contents. this->signs.ForceResort(); @@ -272,7 +272,7 @@ struct SignWindow : QueryStringBaseWindow, SignList { this->cur_sign = si->index; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_LENGTH_SIGN_NAME_PIXELS); - this->InvalidateWidget(QUERY_EDIT_SIGN_WIDGET_TEXT); + this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT); this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 17aa46ed6..0f8c3b3ba 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -427,7 +427,7 @@ void Station::UpdateVirtCoord() SetDParam(1, this->facilities); this->sign.UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION); - InvalidateWindow(WC_STATION_VIEW, this->index); + SetWindowDirty(WC_STATION_VIEW, this->index); } /** Update the virtual coords needed to draw the station sign for all stations. */ @@ -621,7 +621,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg) } /* redraw the station view since acceptance changed */ - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST); } static void UpdateStationSignCoord(BaseStation *st) @@ -1153,7 +1153,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 st->RecomputeIndustriesNear(); InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0); - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS); } return cost; @@ -1310,7 +1310,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected /* if we deleted the whole station, delete the train facility. */ if (st->train_station.tile == INVALID_TILE) { st->facilities &= ~FACIL_TRAIN; - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS); st->UpdateVirtCoord(); DeleteStationIfEmpty(st); } @@ -1345,7 +1345,7 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3 for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) { Station *st = *stp; - if (st->train_station.tile == INVALID_TILE) InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); + if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS); st->MarkTilesDirty(false); st->RecomputeIndustriesNear(); } @@ -1433,7 +1433,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags) st->speclist = NULL; st->cached_anim_triggers = 0; - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS); st->UpdateVirtCoord(); DeleteStationIfEmpty(st); } @@ -1636,7 +1636,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin st->RecomputeIndustriesNear(); InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0); - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS); } return cost; } @@ -1701,7 +1701,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags) pred->next = cur_stop->next; } - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS); delete cur_stop; /* Make sure no vehicle is going to the old roadstop */ @@ -2001,10 +2001,10 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint st->RecomputeIndustriesNear(); InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0); - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES); if (_settings_game.economy.station_noise_level) { - InvalidateWindow(WC_TOWN_VIEW, st->town->index); + SetWindowDirty(WC_TOWN_VIEW, st->town->index); } } @@ -2066,10 +2066,10 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags) st->airport_tile = INVALID_TILE; st->facilities &= ~FACIL_AIRPORT; - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES); if (_settings_game.economy.station_noise_level) { - InvalidateWindow(WC_TOWN_VIEW, st->town->index); + SetWindowDirty(WC_TOWN_VIEW, st->town->index); } st->UpdateVirtCoord(); @@ -2211,7 +2211,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 st->RecomputeIndustriesNear(); InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0); - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS); } return CommandCost(EXPENSES_CONSTRUCTION, _price.build_dock); @@ -2246,7 +2246,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags) st->dock_tile = INVALID_TILE; st->facilities &= ~FACIL_DOCK; - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS); + SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS); st->UpdateVirtCoord(); st->RecomputeIndustriesNear(); DeleteStationIfEmpty(st); @@ -2823,9 +2823,9 @@ static void UpdateStationRating(Station *st) StationID index = st->index; if (waiting_changed) { - InvalidateWindow(WC_STATION_VIEW, index); // update whole window + SetWindowDirty(WC_STATION_VIEW, index); // update whole window } else { - InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list + SetWindowWidgetDirty(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list } } @@ -2891,7 +2891,7 @@ static void UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT StationAnimationTrigger(st, st->xy, STAT_ANIM_NEW_CARGO, type); - InvalidateWindow(WC_STATION_VIEW, st->index); + SetWindowDirty(WC_STATION_VIEW, st->index); st->MarkTilesDirty(true); } diff --git a/src/station_gui.cpp b/src/station_gui.cpp index c2861429a..c3d9ebb2f 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -254,7 +254,7 @@ protected: this->last_station = NULL; /* Set the modified widget dirty */ - this->InvalidateWidget(SLW_LIST); + this->SetWidgetDirty(SLW_LIST); } public: @@ -969,7 +969,7 @@ struct StationViewWindow : public Window { for (CargoID c = 0; c < NUM_CARGO; c++) { if (this->cargo_rows[c] == row) { ToggleBit(this->cargo, c); - this->InvalidateWidget(SVW_WAITING); + this->SetWidgetDirty(SVW_WAITING); break; } } diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index a802e5b07..cfe9d4810 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -171,14 +171,14 @@ struct StatusBarWindow : Window { if (this->ticker_scroll < TICKER_STOP) { // Scrolling text this->ticker_scroll += COUNTER_STEP; - this->InvalidateWidget(SBW_MIDDLE); + this->SetWidgetDirty(SBW_MIDDLE); } if (this->reminder_timeout > REMINDER_STOP) { // Red blot to show there are new unread newsmessages this->reminder_timeout -= COUNTER_STEP; } else if (this->reminder_timeout < REMINDER_STOP) { this->reminder_timeout = REMINDER_STOP; - this->InvalidateWidget(SBW_MIDDLE); + this->SetWidgetDirty(SBW_MIDDLE); } } }; diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index bd0569197..2947c258a 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -734,7 +734,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons if (this->IsWidgetLowered(i)) { this->RaiseWidget(i); - this->InvalidateWidget(i); + this->SetWidgetDirty(i); } } } diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 6be6f57a4..00b96533f 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -40,7 +40,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time v->current_order.wait_time = time; } } - InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index); + SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); } } @@ -176,7 +176,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, ClrBit(v2->vehicle_flags, VF_AUTOFILL_TIMETABLE); ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); } - InvalidateWindow(WC_VEHICLE_TIMETABLE, v2->index); + SetWindowDirty(WC_VEHICLE_TIMETABLE, v2->index); } return CommandCost(); @@ -241,6 +241,6 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) v->lateness_counter -= (timetabled - time_taken); for (v = v->FirstShared(); v != NULL; v = v->NextShared()) { - InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index); + SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); } } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index ff22ed7c8..cd3a06abb 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1120,12 +1120,12 @@ struct MainToolbarWindow : Window { { if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_mode) { this->ToggleWidgetLoweredState(TBN_PAUSE); - this->InvalidateWidget(TBN_PAUSE); + this->SetWidgetDirty(TBN_PAUSE); } if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) { this->ToggleWidgetLoweredState(TBN_FASTFORWARD); - this->InvalidateWidget(TBN_FASTFORWARD); + this->SetWidgetDirty(TBN_FASTFORWARD); } } @@ -1143,7 +1143,7 @@ struct MainToolbarWindow : Window { for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) { if (this->IsWidgetLowered(i)) { this->RaiseWidget(i); - this->InvalidateWidget(i); + this->SetWidgetDirty(i); } } } @@ -1393,8 +1393,8 @@ public: virtual void OnTimeout() { this->SetWidgetsLoweredState(false, TBSE_DATEBACKWARD, TBSE_DATEFORWARD, WIDGET_LIST_END); - this->InvalidateWidget(TBSE_DATEBACKWARD); - this->InvalidateWidget(TBSE_DATEFORWARD); + this->SetWidgetDirty(TBSE_DATEBACKWARD); + this->SetWidgetDirty(TBSE_DATEFORWARD); } virtual void OnTick() diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 8a9a366f9..b7719c879 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -339,7 +339,7 @@ void Town::UpdateVirtCoord() this->sign.UpdatePosition(pt.x, pt.y - 24, _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN); - InvalidateWindow(WC_TOWN_VIEW, this->index); + SetWindowDirty(WC_TOWN_VIEW, this->index); } /** Update the virtual coords needed to draw the town sign for all towns. */ @@ -360,7 +360,7 @@ void UpdateAllTownVirtCoords() static void ChangePopulation(Town *t, int mod) { t->population += mod; - InvalidateWindow(WC_TOWN_VIEW, t->index); + SetWindowDirty(WC_TOWN_VIEW, t->index); t->UpdateVirtCoord(); InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1); @@ -2471,7 +2471,7 @@ static void TownActionBribe(Town *t) */ if (t->ratings[_current_company] > RATING_BRIBE_DOWN_TO) { t->ratings[_current_company] = RATING_BRIBE_DOWN_TO; - InvalidateWindow(WC_TOWN_AUTHORITY, t->index); + SetWindowDirty(WC_TOWN_AUTHORITY, t->index); } } else { ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM, DC_EXEC); @@ -2575,7 +2575,7 @@ CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint if (flags & DC_EXEC) { _town_action_proc[p2](t); - InvalidateWindow(WC_TOWN_AUTHORITY, p1); + SetWindowDirty(WC_TOWN_AUTHORITY, p1); } return cost; @@ -2616,7 +2616,7 @@ static void UpdateTownGrowRate(Town *t) t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM); } - InvalidateWindow(WC_TOWN_AUTHORITY, t->index); + SetWindowDirty(WC_TOWN_AUTHORITY, t->index); ClrBit(t->flags, TOWN_IS_FUNDED); if (_settings_game.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return; @@ -2675,7 +2675,7 @@ static void UpdateTownAmounts(Town *t) t->max_mail = t->new_max_mail; t->new_max_mail = 0; t->act_mail = t->new_act_mail; t->new_act_mail = 0; - InvalidateWindow(WC_TOWN_VIEW, t->index); + SetWindowDirty(WC_TOWN_VIEW, t->index); } static void UpdateTownUnwanted(Town *t) @@ -2821,7 +2821,7 @@ void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags) } else { SetBit(t->have_ratings, _current_company); t->ratings[_current_company] = rating; - InvalidateWindow(WC_TOWN_AUTHORITY, t->index); + SetWindowDirty(WC_TOWN_AUTHORITY, t->index); } } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index bdbe2d2e4..a74957bcc 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -130,8 +130,8 @@ void TrainPowerChanged(Train *v) v->tcache.cached_power = total_power; v->tcache.cached_max_te = max_te; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } @@ -355,7 +355,7 @@ void TrainConsistChanged(Train *v, bool same_length) if (v->IsFrontEngine()) { UpdateTrainAcceleration(v); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } } @@ -768,7 +768,7 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandF TrainConsistChanged(v->First(), false); UpdateTrainGroupID(v->First()); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); if (IsLocalCompany()) { InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window } @@ -939,7 +939,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_TRAINS_LIST, 0); - InvalidateWindow(WC_COMPANY, v->owner); + SetWindowDirty(WC_COMPANY, v->owner); if (IsLocalCompany()) { InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window } @@ -1406,11 +1406,11 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u UpdateTrainGroupID(src_head); if (src_head->IsFrontEngine()) { /* Update the refit button and window */ - InvalidateWindow(WC_VEHICLE_REFIT, src_head->index); - InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH); + SetWindowDirty(WC_VEHICLE_REFIT, src_head->index); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH); } /* Update the depot window */ - InvalidateWindow(WC_VEHICLE_DEPOT, src_head->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, src_head->tile); } if (dst_head != NULL) { @@ -1419,11 +1419,11 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u UpdateTrainGroupID(dst_head); if (dst_head->IsFrontEngine()) { /* Update the refit button and window */ - InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH); - InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH); + SetWindowDirty(WC_VEHICLE_REFIT, dst_head->index); } /* Update the depot window */ - InvalidateWindow(WC_VEHICLE_DEPOT, dst_head->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, dst_head->tile); } InvalidateWindowClassesData(WC_TRAINS_LIST, 0); @@ -1470,7 +1470,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uin DeleteWindowById(WC_VEHICLE_DETAILS, first->index); DeleteWindowById(WC_VEHICLE_TIMETABLE, first->index); } - InvalidateWindow(WC_VEHICLE_DEPOT, first->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, first->tile); InvalidateWindowClassesData(WC_TRAINS_LIST, 0); } @@ -1546,7 +1546,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uin NormaliseTrainConsist(first); TrainConsistChanged(first, false); UpdateTrainGroupID(first); - if (first->IsFrontEngine()) InvalidateWindow(WC_VEHICLE_REFIT, first->index); + if (first->IsFrontEngine()) SetWindowDirty(WC_VEHICLE_REFIT, first->index); } } @@ -1597,7 +1597,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uin NormaliseTrainConsist(first); TrainConsistChanged(first, false); UpdateTrainGroupID(first); - InvalidateWindow(WC_VEHICLE_REFIT, first->index); + SetWindowDirty(WC_VEHICLE_REFIT, first->index); } } break; } @@ -1633,7 +1633,7 @@ static inline void SetLastSpeed(Train *v, int spd) if (spd != old) { v->tcache.last_speed = spd; if (_settings_client.gui.vehicle_speed || (old == 0) != (spd == 0)) { - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } } @@ -1655,7 +1655,7 @@ static void MarkTrainAsStuck(Train *v) v->subspeed = 0; SetLastSpeed(v, 0); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } @@ -1960,7 +1960,7 @@ static void ReverseTrainDirection(Train *v) /* If we are inside a depot after reversing, don't bother with path reserving. */ if (v->track == TRACK_BIT_DEPOT) { /* Can't be stuck here as inside a depot is always a safe tile. */ - if (HasBit(v->flags, VRF_TRAIN_STUCK)) InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + if (HasBit(v->flags, VRF_TRAIN_STUCK)) SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); ClrBit(v->flags, VRF_TRAIN_STUCK); return; } @@ -2018,8 +2018,8 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32 if (flags & DC_EXEC) { ToggleBit(v->flags, VRF_REVERSE_DIRECTION); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } } else { /* turn the whole train around */ @@ -2148,8 +2148,8 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, v->cargo_type = new_cid; v->cargo_cap = amount; v->cargo_subtype = new_subtype; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowClassesData(WC_TRAINS_LIST, 0); } } @@ -2437,7 +2437,7 @@ static bool CheckTrainStayInDepot(Train *v) /* if the train got no power, then keep it in the depot */ if (v->tcache.cached_power == 0) { v->vehstatus |= VS_STOPPED; - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); return true; } @@ -2446,7 +2446,7 @@ static bool CheckTrainStayInDepot(Train *v) if (v->force_proceed == 0) { /* force proceed was not pressed */ if (++v->load_unload_time_rem < 37) { - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowClassesDirty(WC_TRAINS_LIST); return true; } @@ -2455,7 +2455,7 @@ static bool CheckTrainStayInDepot(Train *v) seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner); if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) { /* Full and no PBS signal in block or depot reserved, can't exit. */ - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowClassesDirty(WC_TRAINS_LIST); return true; } } else { @@ -2474,7 +2474,7 @@ static bool CheckTrainStayInDepot(Train *v) /* Only leave when we can reserve a path to our destination. */ if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == 0) { /* No path and no force proceed. */ - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowClassesDirty(WC_TRAINS_LIST); MarkTrainAsStuck(v); return true; } @@ -2483,7 +2483,7 @@ static bool CheckTrainStayInDepot(Train *v) if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile); VehicleServiceInDepot(v); - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowClassesDirty(WC_TRAINS_LIST); v->PlayLeaveStationSound(); v->track = TRACK_BIT_X; @@ -3169,7 +3169,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) /* If we have a reserved path and the path ends at a safe tile, we are finished already. */ if (origin.okay && (v->tile != origin.tile || first_tile_okay)) { /* Can't be stuck then. */ - if (HasBit(v->flags, VRF_TRAIN_STUCK)) InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + if (HasBit(v->flags, VRF_TRAIN_STUCK)) SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); ClrBit(v->flags, VRF_TRAIN_STUCK); return true; } @@ -3197,7 +3197,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) if (HasBit(v->flags, VRF_TRAIN_STUCK)) { v->load_unload_time_rem = 0; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } ClrBit(v->flags, VRF_TRAIN_STUCK); return true; @@ -3536,11 +3536,11 @@ static void SetVehicleCrashed(Train *v) v->crash_anim_pos++; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); if (v->track == TRACK_BIT_DEPOT) { - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); } InvalidateWindowClassesData(WC_TRAINS_LIST, 0); @@ -4024,7 +4024,7 @@ static void DeleteLastWagon(Train *v) /* Update the depot window if the first vehicle is in depot - * if v == first, then it is updated in PreDestructor() */ if (first->track == TRACK_BIT_DEPOT) { - InvalidateWindow(WC_VEHICLE_DEPOT, first->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, first->tile); } } @@ -4121,7 +4121,7 @@ static bool HandleCrashedTrain(Train *v) if (state >= 4440 && !(v->tick_counter & 0x1F)) { bool ret = v->Next() != NULL; DeleteLastWagon(v); - InvalidateWindow(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN); + SetWindowDirty(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN); return ret; } @@ -4137,8 +4137,8 @@ static void HandleBrokenTrain(Train *v) if (v->breakdowns_since_last_service != 255) v->breakdowns_since_last_service++; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? @@ -4154,7 +4154,7 @@ static void HandleBrokenTrain(Train *v) if (!(v->tick_counter & 3)) { if (!--v->breakdown_delay) { v->breakdown_ctr = 0; - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); } } } @@ -4330,7 +4330,7 @@ static bool TrainLocoHandler(Train *v, bool mode) if (v->force_proceed != 0) { v->force_proceed--; ClrBit(v->flags, VRF_TRAIN_STUCK); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } /* train is broken down? */ @@ -4399,13 +4399,13 @@ static bool TrainLocoHandler(Train *v, bool mode) if (v->force_proceed == 0) return true; ClrBit(v->flags, VRF_TRAIN_STUCK); v->load_unload_time_rem = 0; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } } if (v->current_order.IsType(OT_LEAVESTATION)) { v->current_order.Free(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); return true; } @@ -4413,7 +4413,7 @@ static bool TrainLocoHandler(Train *v, bool mode) /* we need to invalidate the widget if we are stopping from 'Stopping 0 km/h' to 'Stopped' */ if (v->cur_speed == 0 && v->tcache.last_speed == 0 && (v->vehstatus & VS_STOPPED)) { - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } int adv_spd = (v->direction & 1) ? 192 : 256; @@ -4521,7 +4521,7 @@ static void CheckIfTrainNeedsService(Train *v) * suddenly moved farther away, we continue our normal * schedule? */ v->current_order.MakeDummy(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } return; } @@ -4536,7 +4536,7 @@ static void CheckIfTrainNeedsService(Train *v) v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE); v->dest_tile = tfdd.tile; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); } void Train::OnNewDay() @@ -4566,8 +4566,8 @@ void Train::OnNewDay() SubtractMoneyFromCompanyFract(this->owner, cost); - InvalidateWindow(WC_VEHICLE_DETAILS, this->index); - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowDirty(WC_VEHICLE_DETAILS, this->index); + SetWindowClassesDirty(WC_TRAINS_LIST); } } else if (this->IsEngine()) { /* Also age engines that aren't front engines */ diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 4ca00e7fb..7046f6e8c 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -117,7 +117,7 @@ public: if (IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN))) { MarkWholeScreenDirty(); } else { - this->InvalidateWidget(TTW_WIDGET_BUTTONS); + this->SetWidgetDirty(TTW_WIDGET_BUTTONS); } } } diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index d6b148f04..fa4f21ae2 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -152,7 +152,7 @@ public: virtual void OnTimeout() { this->RaiseWidget(BTW_MANY_RANDOM); - this->InvalidateWidget(BTW_MANY_RANDOM); + this->SetWidgetDirty(BTW_MANY_RANDOM); } virtual void OnPlaceObjectAbort() diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index a083eb4c2..4fa528b40 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -69,7 +69,7 @@ static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags) DoClearSquare(t + TileDiffXY(1, 0)); DoClearSquare(t + TileDiffXY(1, 1)); c->location_of_HQ = INVALID_TILE; // reset HQ position - InvalidateWindow(WC_COMPANY, cid); + SetWindowDirty(WC_COMPANY, cid); CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, cid); } @@ -127,7 +127,7 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, DoCommandFlag flags, uint32 p1, ui MakeCompanyHQ(tile, _current_company); UpdateCompanyHQ(c, score); - InvalidateWindow(WC_COMPANY, c->index); + SetWindowDirty(WC_COMPANY, c->index); } return cost; @@ -291,7 +291,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags) TownID town = GetStatueTownID(tile); ClrBit(Town::Get(town)->statues, GetTileOwner(tile)); - InvalidateWindow(WC_TOWN_AUTHORITY, town); + SetWindowDirty(WC_TOWN_AUTHORITY, town); } if (flags & DC_EXEC) { @@ -486,7 +486,7 @@ static void ChangeTileOwner_Unmovable(TileIndex tile, Owner old_owner, Owner new DoClearSquare(tile); } - InvalidateWindow(WC_TOWN_AUTHORITY, town); + SetWindowDirty(WC_TOWN_AUTHORITY, town); } else { DoClearSquare(tile); } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 3b858e60d..6a7cdebfd 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -87,7 +87,7 @@ void VehicleServiceInDepot(Vehicle *v) v->date_of_last_service = _date; v->breakdowns_since_last_service = 0; v->reliability = Engine::Get(v->engine_type)->reliability; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated } bool Vehicle::NeedsServicing() const @@ -517,7 +517,7 @@ void Vehicle::PreDestructor() DeleteWindowById(WC_VEHICLE_REFIT, this->index); DeleteWindowById(WC_VEHICLE_DETAILS, this->index); DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index); - InvalidateWindow(WC_COMPANY, this->owner); + SetWindowDirty(WC_COMPANY, this->owner); } InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type), 0); @@ -824,7 +824,7 @@ Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y) void DecreaseVehicleValue(Vehicle *v) { v->value -= v->value >> 8; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } static const byte _breakdown_chance[64] = { @@ -844,7 +844,7 @@ void CheckVehicleBreakdown(Vehicle *v) /* decrease reliability */ v->reliability = rel = max((rel_old = v->reliability) - v->reliability_spd_dec, 0); - if ((rel_old >> 8) != (rel >> 8)) InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + if ((rel_old >> 8) != (rel >> 8)) SetWindowDirty(WC_VEHICLE_DETAILS, v->index); if (v->breakdown_ctr != 0 || (v->vehstatus & VS_STOPPED) || _settings_game.difficulty.vehicle_breakdowns < 1 || @@ -884,7 +884,7 @@ void AgeVehicle(Vehicle *v) v->reliability_spd_dec <<= 1; } - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); /* Don't warn about non-primary or not ours vehicles or vehicles that are crashed */ if (v->Previous() != NULL || v->owner != _local_company || (v->vehstatus & VS_CRASHED) != 0) return; @@ -960,7 +960,7 @@ void VehicleEnterDepot(Vehicle *v) switch (v->type) { case VEH_TRAIN: { Train *t = Train::From(v); - InvalidateWindowClasses(WC_TRAINS_LIST); + SetWindowClassesDirty(WC_TRAINS_LIST); /* Clear path reservation */ SetDepotReservation(t->tile, false); if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile); @@ -973,17 +973,17 @@ void VehicleEnterDepot(Vehicle *v) } case VEH_ROAD: - InvalidateWindowClasses(WC_ROADVEH_LIST); + SetWindowClassesDirty(WC_ROADVEH_LIST); break; case VEH_SHIP: - InvalidateWindowClasses(WC_SHIPS_LIST); + SetWindowClassesDirty(WC_SHIPS_LIST); Ship::From(v)->state = TRACK_BIT_DEPOT; RecalcShipStuff(v); break; case VEH_AIRCRAFT: - InvalidateWindowClasses(WC_AIRCRAFT_LIST); + SetWindowClassesDirty(WC_AIRCRAFT_LIST); HandleAircraftEnterHangar(Aircraft::From(v)); break; default: NOT_REACHED(); @@ -994,7 +994,7 @@ void VehicleEnterDepot(Vehicle *v) * We only increase the number of vehicles when the first one enters, so we will not need to search for more vehicles in the depot */ InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); } - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); v->vehstatus |= VS_HIDDEN; v->cur_speed = 0; @@ -1004,7 +1004,7 @@ void VehicleEnterDepot(Vehicle *v) TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT); if (v->current_order.IsType(OT_GOTO_DEPOT)) { - InvalidateWindow(WC_VEHICLE_VIEW, v->index); + SetWindowDirty(WC_VEHICLE_VIEW, v->index); const Order *real_order = v->GetOrder(v->cur_order_index); Order t = v->current_order; @@ -1435,10 +1435,10 @@ void Vehicle::BeginLoading() PrepareUnload(this); - InvalidateWindow(GetWindowClassForVehicleType(this->type), this->owner); - InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); - InvalidateWindow(WC_VEHICLE_DETAILS, this->index); - InvalidateWindow(WC_STATION_VIEW, this->last_station_visited); + SetWindowDirty(GetWindowClassForVehicleType(this->type), this->owner); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DETAILS, this->index); + SetWindowDirty(WC_STATION_VIEW, this->last_station_visited); Station::Get(this->last_station_visited)->MarkTilesDirty(true); this->cur_speed = 0; @@ -1517,7 +1517,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command) if (flags & DC_EXEC) { this->current_order.SetDepotOrderType(ODTF_MANUAL); this->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT); - InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); } return CommandCost(); } @@ -1529,7 +1529,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command) if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->IncrementOrderIndex(); this->current_order.MakeDummy(); - InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); } return CommandCost(); } @@ -1546,7 +1546,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command) this->dest_tile = location; this->current_order.MakeGoToDepot(destination, ODTF_MANUAL); if (!(command & DEPOT_SERVICE)) this->current_order.SetDepotActionType(ODATFB_HALT); - InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); /* If there is no depot in front, reverse automatically (trains only) */ if (this->type == VEH_TRAIN && reverse) DoCommand(this->tile, this->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION); @@ -1645,8 +1645,8 @@ void StopAllVehicles() /* Code ripped from CmdStartStopTrain. Can't call it, because of * ownership problems, so we'll duplicate some code, for now */ v->vehstatus |= VS_STOPPED; - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); } } @@ -1672,7 +1672,7 @@ void VehiclesYearlyLoop() v->profit_last_year = v->profit_this_year; v->profit_this_year = 0; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } } } diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index c757c2ae2..3dd58ec6b 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -106,9 +106,9 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, v->vehstatus ^= VS_STOPPED; if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly' - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); - InvalidateWindowClasses(GetWindowClassForVehicleType(v->type)); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); + SetWindowClassesDirty(GetWindowClassForVehicleType(v->type)); } return CommandCost(); } @@ -567,7 +567,7 @@ CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, if (flags & DC_EXEC) { v->service_interval = serv_int; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } return CommandCost(); diff --git a/src/viewport.cpp b/src/viewport.cpp index 198eeee1b..5285a28b4 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -462,10 +462,10 @@ Point GetTileZoomCenterWindow(bool in, Window * w) void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out) { w->SetWidgetDisabledState(widget_zoom_in, vp->zoom == ZOOM_LVL_MIN); - w->InvalidateWidget(widget_zoom_in); + w->SetWidgetDirty(widget_zoom_in); w->SetWidgetDisabledState(widget_zoom_out, vp->zoom == ZOOM_LVL_MAX); - w->InvalidateWidget(widget_zoom_out); + w->SetWidgetDirty(widget_zoom_out); } /** diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 2f27bc704..3857536a4 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -837,8 +837,8 @@ static void FloodVehicle(Vehicle *v) return; } - InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); - InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); + SetWindowDirty(WC_VEHICLE_DEPOT, v->tile); AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED)); SetDParam(0, pass); diff --git a/src/widget.cpp b/src/widget.cpp index e39712e9c..6719a2506 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -991,7 +991,7 @@ inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, ui * Mark the widget as 'dirty' (in need of repaint). * @param w Window owning the widget. */ -void NWidgetBase::Invalidate(const Window *w) const +void NWidgetBase::SetDirty(const Window *w) const { int abs_left = w->left + this->pos_x; int abs_top = w->top + this->pos_y; @@ -1654,7 +1654,7 @@ void NWidgetSpacer::Draw(const Window *w) /* Spacer widget is never visible. */ } -void NWidgetSpacer::Invalidate(const Window *w) const +void NWidgetSpacer::SetDirty(const Window *w) const { /* Spacer widget never need repainting. */ } diff --git a/src/widget_type.h b/src/widget_type.h index fdab0d9eb..7d5a68494 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -209,7 +209,7 @@ public: inline uint GetVerticalStepSize(SizingType sizing) const; virtual void Draw(const Window *w) = 0; - virtual void Invalidate(const Window *w) const; + virtual void SetDirty(const Window *w) const; WidgetType type; ///< Type of the widget / nested widget. bool fill_x; ///< Allow horizontal filling from initial size. @@ -458,7 +458,7 @@ public: /* virtual */ void FillNestedArray(NWidgetCore **array, uint length); /* virtual */ void Draw(const Window *w); - /* virtual */ void Invalidate(const Window *w) const; + /* virtual */ void SetDirty(const Window *w) const; /* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y); }; diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 7ab26026d..e78dc153d 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -104,7 +104,7 @@ struct DropdownWindow : Window { Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num); if (w2 != NULL) { w2->RaiseWidget(this->parent_button); - w2->InvalidateWidget(this->parent_button); + w2->SetWidgetDirty(this->parent_button); } DeleteDropDownList(this->list); @@ -252,7 +252,7 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u DeleteWindowById(WC_DROPDOWN_MENU, 0); w->LowerWidget(button); - w->InvalidateWidget(button); + w->SetWidgetDirty(button); /* Our parent's button widget is used to determine where to place the drop * down list window. */ diff --git a/src/window.cpp b/src/window.cpp index 222dd04d1..2f007b1c5 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -107,9 +107,9 @@ void SetFocusedWindow(Window *w) if (_focused_window != NULL) { if (_focused_window->focused_widget != NULL) { uint focused_widget_id = _focused_window->focused_widget - _focused_window->widget; - _focused_window->InvalidateWidget(focused_widget_id); + _focused_window->SetWidgetDirty(focused_widget_id); } - if (_focused_window->nested_focus != NULL) _focused_window->nested_focus->Invalidate(_focused_window); + if (_focused_window->nested_focus != NULL) _focused_window->nested_focus->SetDirty(_focused_window); } /* Remember which window was previously focused */ @@ -152,7 +152,7 @@ bool Window::SetFocusedWidget(byte widget_index) if (this->focused_widget != NULL) { /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */ - this->InvalidateWidget(this->focused_widget - this->widget); + this->SetWidgetDirty(this->focused_widget - this->widget); } this->focused_widget = &this->widget[widget_index]; return true; @@ -167,7 +167,7 @@ bool Window::SetFocusedWidget(byte widget_index) if (this->nested_array[widget_index] == this->nested_focus) return false; /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */ - this->nested_focus->Invalidate(this); + this->nested_focus->SetDirty(this); } this->nested_focus = this->nested_array[widget_index]; return true; @@ -246,7 +246,7 @@ void Window::RaiseButtons(bool autoraise) for (uint i = 0; i < this->widget_count; i++) { if ((!autoraise || (this->widget[i].type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) { this->RaiseWidget(i); - this->InvalidateWidget(i); + this->SetWidgetDirty(i); } } } @@ -254,7 +254,7 @@ void Window::RaiseButtons(bool autoraise) for (uint i = 0; i < this->nested_array_size; i++) { if (this->nested_array[i] != NULL && (!autoraise || (this->nested_array[i]->type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) { this->RaiseWidget(i); - this->InvalidateWidget(i); + this->SetWidgetDirty(i); } } } @@ -264,7 +264,7 @@ void Window::RaiseButtons(bool autoraise) * Invalidate a widget, i.e. mark it as being changed and in need of redraw. * @param widget_index the widget to redraw. */ -void Window::InvalidateWidget(byte widget_index) const +void Window::SetWidgetDirty(byte widget_index) const { if (this->widget != NULL) { const Widget *wi = &this->widget[widget_index]; @@ -274,7 +274,7 @@ void Window::InvalidateWidget(byte widget_index) const SetDirtyBlocks(this->left + wi->left, this->top + wi->top, this->left + wi->right + 1, this->top + wi->bottom + 1); } - if (this->nested_array != NULL) this->nested_array[widget_index]->Invalidate(this); + if (this->nested_array != NULL) this->nested_array[widget_index]->SetDirty(this); } /** @@ -286,7 +286,7 @@ void Window::HandleButtonClick(byte widget) { this->LowerWidget(widget); this->flags4 |= WF_TIMEOUT_BEGIN; - this->InvalidateWidget(widget); + this->SetWidgetDirty(widget); } /** @@ -409,13 +409,13 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click) * we assume that that button is used to resize to the left. */ int left_pos = (wi != NULL) ? wi->left : nw->pos_x; StartWindowSizing(w, left_pos < (w->width / 2)); - w->InvalidateWidget(widget_index); + w->SetWidgetDirty(widget_index); return; } if ((w->desc_flags & WDF_STICKY_BUTTON) && widget_type == WWT_STICKYBOX) { w->flags4 ^= WF_STICKY; - w->InvalidateWidget(widget_index); + w->SetWidgetDirty(widget_index); return; } } @@ -2440,7 +2440,7 @@ void UpdateWindows() * @param cls Window class * @param number Window number in that class */ -void InvalidateWindow(WindowClass cls, WindowNumber number) +void SetWindowDirty(WindowClass cls, WindowNumber number) { const Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { @@ -2454,12 +2454,12 @@ void InvalidateWindow(WindowClass cls, WindowNumber number) * @param number Window number in that class * @param widget_index Index number of the widget that needs repainting */ -void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index) +void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index) { const Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { if (w->window_class == cls && w->window_number == number) { - w->InvalidateWidget(widget_index); + w->SetWidgetDirty(widget_index); } } } @@ -2468,7 +2468,7 @@ void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_in * Mark all windows of a particular class as dirty (in need of repainting) * @param cls Window class */ -void InvalidateWindowClasses(WindowClass cls) +void SetWindowClassesDirty(WindowClass cls) { Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { diff --git a/src/window_func.h b/src/window_func.h index 1690a310c..f14d94459 100644 --- a/src/window_func.h +++ b/src/window_func.h @@ -39,9 +39,9 @@ void ShowVitalWindows(); void ReInitAllWindows(); -void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index); -void InvalidateWindow(WindowClass cls, WindowNumber number); -void InvalidateWindowClasses(WindowClass cls); +void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index); +void SetWindowDirty(WindowClass cls, WindowNumber number); +void SetWindowClassesDirty(WindowClass cls); void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true); void DeleteWindowByClass(WindowClass cls); diff --git a/src/window_gui.h b/src/window_gui.h index 9a52ae846..13deb83a0 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -619,7 +619,7 @@ public: void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...); void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); - void InvalidateWidget(byte widget_index) const; + void SetWidgetDirty(byte widget_index) const; void DrawWidgets() const; void DrawViewport() const; |