(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.

pull/155/head
frosch 15 years ago
parent 9a0a14f4a8
commit 0e36260337

@ -153,7 +153,7 @@ struct AIListWindow : public Window {
for (int i = 0; i < this->selected; i++) it++; for (int i = 0; i < this->selected; i++) it++;
AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion()); 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) virtual void OnClick(Point pt, int widget)
@ -767,7 +767,7 @@ struct AIDebugWindow : public Window {
this->vscroll.SetCount(scroll_count); this->vscroll.SetCount(scroll_count);
/* We need a repaint */ /* We need a repaint */
this->InvalidateWidget(AID_WIDGET_SCROLLBAR); this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
} }
if (log == NULL) return; if (log == NULL) return;
@ -783,8 +783,8 @@ struct AIDebugWindow : public Window {
this->vscroll.SetPosition(scroll_pos); this->vscroll.SetPosition(scroll_pos);
/* We need a repaint */ /* We need a repaint */
this->InvalidateWidget(AID_WIDGET_SCROLLBAR); this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
this->InvalidateWidget(AID_WIDGET_LOG_PANEL); this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
} }
} }
this->last_vscroll_pos = this->vscroll.GetPosition(); this->last_vscroll_pos = this->vscroll.GetPosition();

@ -433,7 +433,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0); InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner); SetWindowDirty(WC_COMPANY, v->owner);
if (IsLocalCompany()) if (IsLocalCompany())
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window 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->cargo_subtype = new_subtype;
v->colourmap = PAL_NONE; // invalidate vehicle colour map v->colourmap = PAL_NONE; // invalidate vehicle colour map
v->InvalidateNewGRFCacheOfChain(); v->InvalidateNewGRFCacheOfChain();
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0); 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); // printf("targetairport = %d, st->index = %d\n", v->targetairport, st->index);
// v->targetairport = st->index; // v->targetairport = st->index;
v->current_order.MakeGoToDepot(st->index, ODTFB_SERVICE); 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)) { } else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
v->current_order.MakeDummy(); 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); SubtractMoneyFromCompanyFract(this->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
InvalidateWindowClasses(WC_AIRCRAFT_LIST); SetWindowClassesDirty(WC_AIRCRAFT_LIST);
} }
static void HelicopterTickHandler(Aircraft *v) 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) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_settings_client.gui.vehicle_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);
} }
/* Adjust distance moved by plane speed setting */ /* Adjust distance moved by plane speed setting */
@ -1219,8 +1219,8 @@ static void HandleBrokenAircraft(Aircraft *v)
if (v->breakdowns_since_last_service != 255) if (v->breakdowns_since_last_service != 255)
v->breakdowns_since_last_service++; v->breakdowns_since_last_service++;
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, 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); CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
uint amt = 2; uint amt = 2;
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count(); if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count();
@ -1439,7 +1439,7 @@ void AircraftLeaveHangar(Aircraft *v)
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos); SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); 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 /** 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->date_of_last_service = _date;
v->breakdowns_since_last_service = 0; v->breakdowns_since_last_service = 0;
v->reliability = Engine::Get(v->engine_type)->reliability; v->reliability = Engine::Get(v->engine_type)->reliability;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
} }
} }
return; return;

@ -121,8 +121,8 @@ private:
this->nested_array[BBSW_DROPDOWN_CRITERIA]->widget_data = this->sorter_names[this->bridges->SortType()]; this->nested_array[BBSW_DROPDOWN_CRITERIA]->widget_data = this->sorter_names[this->bridges->SortType()];
/* Set the modified widgets dirty */ /* Set the modified widgets dirty */
this->InvalidateWidget(BBSW_DROPDOWN_CRITERIA); this->SetWidgetDirty(BBSW_DROPDOWN_CRITERIA);
this->InvalidateWidget(BBSW_BRIDGE_LIST); this->SetWidgetDirty(BBSW_BRIDGE_LIST);
} }
public: public:

@ -67,7 +67,7 @@ static int32 ClickChangeCompanyCheat(int32 p1, int32 p2)
*/ */
static int32 ClickSetProdCheat(int32 p1, int32 p2) static int32 ClickSetProdCheat(int32 p1, int32 p2)
{ {
InvalidateWindowClasses(WC_INDUSTRY_VIEW); SetWindowClassesDirty(WC_INDUSTRY_VIEW);
return p1; return p1;
} }
@ -104,7 +104,7 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day)); SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
EnginesMonthlyLoop(); EnginesMonthlyLoop();
InvalidateWindow(WC_STATUS_BAR, 0); SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindowClassesData(WC_BUILD_STATION, 0); InvalidateWindowClassesData(WC_BUILD_STATION, 0);
ResetSignalVariant(); ResetSignalVariant();
return _cur_year; return _cur_year;

@ -149,8 +149,8 @@ void InvalidateCompanyWindows(const Company *company)
{ {
CompanyID cid = company->index; CompanyID cid = company->index;
if (cid == _local_company) InvalidateWindow(WC_STATUS_BAR, 0); if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindow(WC_FINANCES, cid); SetWindowDirty(WC_FINANCES, cid);
} }
bool CheckCompanyHasMoney(CommandCost cost) bool CheckCompanyHasMoney(CommandCost cost)
@ -459,9 +459,9 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
GeneratePresidentName(c); GeneratePresidentName(c);
InvalidateWindow(WC_GRAPH_LEGEND, 0); SetWindowDirty(WC_GRAPH_LEGEND, 0);
InvalidateWindow(WC_TOOLBAR_MENU, 0); SetWindowDirty(WC_TOOLBAR_MENU, 0);
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index); if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
@ -595,7 +595,7 @@ void CompaniesYearlyLoop()
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {
memmove(&c->yearly_expenses[1], &c->yearly_expenses[0], sizeof(c->yearly_expenses) - sizeof(c->yearly_expenses[0])); 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])); 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) { if (_settings_client.gui.show_finances && _local_company != COMPANY_SPECTATOR) {

@ -1665,7 +1665,7 @@ struct CompanyWindow : Window
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ); this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ);
this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ); this->SetWidgetDirty(CW_WIDGET_BUILD_VIEW_HQ);
} else { } else {
if (_ctrl_pressed) { if (_ctrl_pressed) {
ShowExtraViewPortWindow(tile); ShowExtraViewPortWindow(tile);
@ -1680,7 +1680,7 @@ struct CompanyWindow : Window
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
this->LowerWidget(CW_WIDGET_RELOCATE_HQ); this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ); this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ);
break; break;
case CW_WIDGET_BUY_SHARE: case CW_WIDGET_BUY_SHARE:

@ -383,7 +383,7 @@ DEF_CONSOLE_CMD(ConClearBuffer)
} }
IConsoleClearBuffer(); IConsoleClearBuffer();
InvalidateWindow(WC_CONSOLE, 0); SetWindowDirty(WC_CONSOLE, 0);
return true; return true;
} }

@ -141,7 +141,7 @@ static void IConsoleClearCommand()
_iconsole_cmdline.width = 0; _iconsole_cmdline.width = 0;
_iconsole_cmdline.caretpos = 0; _iconsole_cmdline.caretpos = 0;
_iconsole_cmdline.caretxoffs = 0; _iconsole_cmdline.caretxoffs = 0;
InvalidateWindow(WC_CONSOLE, 0); SetWindowDirty(WC_CONSOLE, 0);
} }
static inline void IConsoleResetHistoryPos() {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} 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) void IConsoleGUIPrint(ConsoleColour colour_code, char *str)
{ {
new IConsoleLine(str, (TextColour)colour_code); new IConsoleLine(str, (TextColour)colour_code);
InvalidateWindow(WC_CONSOLE, 0); SetWindowDirty(WC_CONSOLE, 0);
} }

@ -240,7 +240,7 @@ static void OnNewMonth()
RedrawAutosave(); RedrawAutosave();
} }
InvalidateWindowClasses(WC_CHEATS); SetWindowClassesDirty(WC_CHEATS);
CompaniesMonthlyLoop(); CompaniesMonthlyLoop();
SubsidyMonthlyLoop(); SubsidyMonthlyLoop();
EnginesMonthlyLoop(); EnginesMonthlyLoop();
@ -264,7 +264,7 @@ static void OnNewDay()
DisasterDailyLoop(); DisasterDailyLoop();
IndustryDailyLoop(); IndustryDailyLoop();
InvalidateWindowWidget(WC_STATUS_BAR, 0, 0); SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0);
EnginesDailyLoop(); EnginesDailyLoop();
} }

@ -726,7 +726,7 @@ struct DepotWindow : Window {
break; break;
case DEPOT_WIDGET_CLONE: // Clone button case DEPOT_WIDGET_CLONE: // Clone button
this->InvalidateWidget(DEPOT_WIDGET_CLONE); this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE); this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE);
if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) { if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) {
@ -850,11 +850,11 @@ struct DepotWindow : Window {
{ {
/* abort clone */ /* abort clone */
this->RaiseWidget(DEPOT_WIDGET_CLONE); this->RaiseWidget(DEPOT_WIDGET_CLONE);
this->InvalidateWidget(DEPOT_WIDGET_CLONE); this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
/* abort drag & drop */ /* abort drag & drop */
this->sel = INVALID_VEHICLE; this->sel = INVALID_VEHICLE;
this->InvalidateWidget(DEPOT_WIDGET_MATRIX); this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
}; };
/* check if a vehicle in a depot was clicked.. */ /* check if a vehicle in a depot was clicked.. */
@ -935,11 +935,11 @@ struct DepotWindow : Window {
{ {
if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) { if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) {
this->RaiseWidget(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)) { if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL_CHAIN)) {
this->RaiseWidget(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) { if (this->sel != INVALID_VEHICLE) {
_cursor.vehchain = _ctrl_pressed; _cursor.vehchain = _ctrl_pressed;
this->InvalidateWidget(DEPOT_WIDGET_MATRIX); this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
return ES_HANDLED; return ES_HANDLED;
} }

@ -281,7 +281,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
c->old_economy[0].company_value = CalculateCompanyValue(c); c->old_economy[0].company_value = CalculateCompanyValue(c);
} }
InvalidateWindow(WC_PERFORMANCE_DETAIL, 0); SetWindowDirty(WC_PERFORMANCE_DETAIL, 0);
return score; return score;
} }
@ -576,12 +576,12 @@ static void CompaniesGenStatistics()
CompanyCheckBankrupt(c); CompanyCheckBankrupt(c);
} }
InvalidateWindow(WC_INCOME_GRAPH, 0); SetWindowDirty(WC_INCOME_GRAPH, 0);
InvalidateWindow(WC_OPERATING_PROFIT, 0); SetWindowDirty(WC_OPERATING_PROFIT, 0);
InvalidateWindow(WC_DELIVERED_CARGO, 0); SetWindowDirty(WC_DELIVERED_CARGO, 0);
InvalidateWindow(WC_PERFORMANCE_HISTORY, 0); SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
InvalidateWindow(WC_COMPANY_VALUE, 0); SetWindowDirty(WC_COMPANY_VALUE, 0);
InvalidateWindow(WC_COMPANY_LEAGUE, 0); SetWindowDirty(WC_COMPANY_LEAGUE, 0);
} }
/** /**
@ -670,10 +670,10 @@ void RecomputePrices()
cs->current_payment = ((int64)cs->initial_payment * _economy.inflation_payment) >> 16; cs->current_payment = ((int64)cs->initial_payment * _economy.inflation_payment) >> 16;
} }
InvalidateWindowClasses(WC_BUILD_VEHICLE); SetWindowClassesDirty(WC_BUILD_VEHICLE);
InvalidateWindowClasses(WC_REPLACE_VEHICLE); SetWindowClassesDirty(WC_REPLACE_VEHICLE);
InvalidateWindowClasses(WC_VEHICLE_DETAILS); SetWindowClassesDirty(WC_VEHICLE_DETAILS);
InvalidateWindow(WC_PAYMENT_RATES, 0); SetWindowDirty(WC_PAYMENT_RATES, 0);
} }
static void CompaniesPayInterest() static void CompaniesPayInterest()
@ -966,7 +966,7 @@ static void TriggerIndustryProduction(Industry *i)
if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) { if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) {
IndustryProductionCallback(i, 0); IndustryProductionCallback(i, 0);
} else { } else {
InvalidateWindow(WC_INDUSTRY_VIEW, i->index); SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
} }
} else { } else {
for (uint cargo_index = 0; cargo_index < lengthof(i->incoming_cargo_waiting); cargo_index++) { 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) { if (result != 0) {
InvalidateWindow(GetWindowClassForVehicleType(v->type), v->owner); SetWindowDirty(GetWindowClassForVehicleType(v->type), v->owner);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
st->MarkTilesDirty(true); st->MarkTilesDirty(true);
v->MarkDirty(); 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; break;
} }
} }
InvalidateWindow(WC_COMPANY, p1); SetWindowDirty(WC_COMPANY, p1);
} }
return cost; return cost;
} }
@ -1525,7 +1525,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1
OwnerByte *b = c->share_owners; OwnerByte *b = c->share_owners;
while (*b != _current_company) b++; // share owners is guaranteed to contain company while (*b != _current_company) b++; // share owners is guaranteed to contain company
*b = COMPANY_SPECTATOR; *b = COMPANY_SPECTATOR;
InvalidateWindow(WC_COMPANY, p1); SetWindowDirty(WC_COMPANY, p1);
} }
return CommandCost(EXPENSES_OTHER, cost); return CommandCost(EXPENSES_OTHER, cost);
} }

@ -436,8 +436,8 @@ static void CalcEngineReliability(Engine *e)
/* Kick this engine out of the lists */ /* Kick this engine out of the lists */
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type); AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
} }
InvalidateWindowClasses(WC_BUILD_VEHICLE); // Update to show the new reliability SetWindowClassesDirty(WC_BUILD_VEHICLE); // Update to show the new reliability
InvalidateWindowClasses(WC_REPLACE_VEHICLE); SetWindowClassesDirty(WC_REPLACE_VEHICLE);
} }
void SetYearEngineAgingStops() void SetYearEngineAgingStops()

@ -54,8 +54,8 @@ extern void MakeNewgameSettingsLive();
static inline void SetNewLandscapeType(byte landscape) static inline void SetNewLandscapeType(byte landscape)
{ {
_settings_newgame.game_creation.landscape = landscape; _settings_newgame.game_creation.landscape = landscape;
InvalidateWindowClasses(WC_SELECT_GAME); SetWindowClassesDirty(WC_SELECT_GAME);
InvalidateWindowClasses(WC_GENERATE_LANDSCAPE); SetWindowClassesDirty(WC_GENERATE_LANDSCAPE);
} }
enum GenerateLandscapeWindowWidgets { enum GenerateLandscapeWindowWidgets {
@ -802,7 +802,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
if (this->IsWidgetLowered(*widget)) { if (this->IsWidgetLowered(*widget)) {
this->RaiseWidget(*widget); this->RaiseWidget(*widget);
this->InvalidateWidget(*widget); this->SetWidgetDirty(*widget);
} }
} }
} }
@ -880,12 +880,12 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
switch (this->widget_id) { switch (this->widget_id) {
case GLAND_START_DATE_TEXT: 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); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
break; break;
case GLAND_SNOW_LEVEL_TEXT: 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); _settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT);
break; break;
@ -936,7 +936,7 @@ static void _ShowGenerateLandscape(glwp_modes mode)
strecpy(w->name, _file_to_saveload.title, lastof(w->name)); strecpy(w->name, _file_to_saveload.title, lastof(w->name));
} }
InvalidateWindow(WC_GENERATE_LANDSCAPE, mode); SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
} }
void ShowGenerateLandscape() void ShowGenerateLandscape()
@ -1100,12 +1100,12 @@ struct CreateScenarioWindow : public Window
switch (this->widget_id) { switch (this->widget_id) {
case CSCEN_START_DATE_TEXT: 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); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
break; break;
case CSCEN_FLAT_LAND_HEIGHT_TEXT: 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); _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT);
break; break;
} }
@ -1396,7 +1396,7 @@ static void _SetGeneratingWorldProgress(gwp_class cls, uint progress, uint total
return; return;
} }
InvalidateWindow(WC_GENERATE_PROGRESS_WINDOW, 0); SetWindowDirty(WC_GENERATE_PROGRESS_WINDOW, 0);
MarkWholeScreenDirty(); MarkWholeScreenDirty();
/* Release the rights to the map generator, and acquire the rights to the /* Release the rights to the map generator, and acquire the rights to the

@ -87,11 +87,11 @@ struct GraphLegendWindow : Window {
ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY); ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY);
this->ToggleWidgetLoweredState(widget); this->ToggleWidgetLoweredState(widget);
this->SetDirty(); this->SetDirty();
InvalidateWindow(WC_INCOME_GRAPH, 0); SetWindowDirty(WC_INCOME_GRAPH, 0);
InvalidateWindow(WC_OPERATING_PROFIT, 0); SetWindowDirty(WC_OPERATING_PROFIT, 0);
InvalidateWindow(WC_DELIVERED_CARGO, 0); SetWindowDirty(WC_DELIVERED_CARGO, 0);
InvalidateWindow(WC_PERFORMANCE_HISTORY, 0); SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
InvalidateWindow(WC_COMPANY_VALUE, 0); SetWindowDirty(WC_COMPANY_VALUE, 0);
} }
virtual void OnInvalidateData(int data) virtual void OnInvalidateData(int data)
@ -403,7 +403,7 @@ protected:
Window(desc, window_number), has_negative_values(has_negative_values), Window(desc, window_number), has_negative_values(has_negative_values),
format_str_y_axis(format_str_y_axis) format_str_y_axis(format_str_y_axis)
{ {
InvalidateWindow(WC_GRAPH_LEGEND, 0); SetWindowDirty(WC_GRAPH_LEGEND, 0);
this->num_vert_lines = 24; this->num_vert_lines = 24;
this->graph_location.left = left; this->graph_location.left = left;

@ -228,7 +228,7 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u
} }
/* Update the Replace Vehicle Windows */ /* 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); 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 */ /* 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 */ /* 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) uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e)

@ -676,7 +676,7 @@ public:
{ {
/* abort drag & drop */ /* abort drag & drop */
this->vehicle_sel = INVALID_VEHICLE; this->vehicle_sel = INVALID_VEHICLE;
this->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE); this->SetWidgetDirty(GRP_WIDGET_LIST_VEHICLE);
} }
void ShowRenameGroupWindow(GroupID group) void ShowRenameGroupWindow(GroupID group)

@ -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 */ /** Simple helper that will collect data for the generation of industries */

@ -806,7 +806,7 @@ protected:
if (!this->industries.Sort()) return; if (!this->industries.Sort()) return;
IndustryDirectoryWindow::last_industry = NULL; // Reset name sorter sort cache 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
} }
/** /**

@ -35,7 +35,7 @@
static inline void SetNewLandscapeType(byte landscape) static inline void SetNewLandscapeType(byte landscape)
{ {
_settings_newgame.game_creation.landscape = landscape; _settings_newgame.game_creation.landscape = landscape;
InvalidateWindowClasses(WC_SELECT_GAME); SetWindowClassesDirty(WC_SELECT_GAME);
} }
enum SelectGameIntroWidgets { enum SelectGameIntroWidgets {

@ -354,8 +354,8 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2,
} }
} }
InvalidateWindow(WC_STATUS_BAR, 0); SetWindowDirty(WC_STATUS_BAR, 0);
InvalidateWindow(WC_MAIN_TOOLBAR, 0); SetWindowDirty(WC_MAIN_TOOLBAR, 0);
} }
return CommandCost(); return CommandCost();
} }

@ -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_RETURN: case WKC_NUM_ENTER: return HEBR_CONFIRM;
case (WKC_CTRL | 'V'): case (WKC_CTRL | 'V'):
if (InsertTextBufferClipboard(&this->text)) w->InvalidateWidget(wid); if (InsertTextBufferClipboard(&this->text)) w->SetWidgetDirty(wid);
break; break;
case (WKC_CTRL | 'U'): case (WKC_CTRL | 'U'):
DeleteTextBufferAll(&this->text); DeleteTextBufferAll(&this->text);
w->InvalidateWidget(wid); w->SetWidgetDirty(wid);
break; break;
case WKC_BACKSPACE: case WKC_DELETE: case WKC_BACKSPACE: case WKC_DELETE:
if (DeleteTextBufferChar(&this->text, keycode)) w->InvalidateWidget(wid); if (DeleteTextBufferChar(&this->text, keycode)) w->SetWidgetDirty(wid);
break; break;
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: 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; break;
default: default:
if (IsValidChar(key, this->afilter)) { if (IsValidChar(key, this->afilter)) {
if (InsertTextBufferChar(&this->text, key)) w->InvalidateWidget(wid); if (InsertTextBufferChar(&this->text, key)) w->SetWidgetDirty(wid);
} else { } else {
state = Window::ES_NOT_HANDLED; 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) void QueryString::HandleEditBox(Window *w, int wid)
{ {
if (HasEditBoxFocus(w, wid) && HandleCaret(&this->text)) { 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, /* When we're not the OSK, notify 'our' OSK to redraw the widget,
* so the caret changes appropriately. */ * so the caret changes appropriately. */
if (w->window_class != WC_OSK) { if (w->window_class != WC_OSK) {
@ -1932,7 +1932,7 @@ public:
/* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */ /* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */
ttd_strlcpy(this->text.buf, file->title, this->text.maxsize); ttd_strlcpy(this->text.buf, file->title, this->text.maxsize);
UpdateTextBufferSize(&this->text); UpdateTextBufferSize(&this->text);
this->InvalidateWidget(SLWW_SAVE_OSK_TITLE); this->SetWidgetDirty(SLWW_SAVE_OSK_TITLE);
} }
} else { } else {
/* Changed directory, need repaint. */ /* Changed directory, need repaint. */
@ -2078,7 +2078,7 @@ void ShowSaveLoadDialog(SaveLoadDialogMode mode)
void RedrawAutosave() void RedrawAutosave()
{ {
InvalidateWindow(WC_STATUS_BAR, 0); SetWindowDirty(WC_STATUS_BAR, 0);
} }
void SetFiosType(const byte fiostype) void SetFiosType(const byte fiostype)

@ -148,7 +148,7 @@ static void StopMusic()
_music_wnd_cursong = 0; _music_wnd_cursong = 0;
DoStopMusic(); DoStopMusic();
_song_is_active = false; _song_is_active = false;
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9); SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
} }
static void PlayPlaylistSong() static void PlayPlaylistSong()
@ -169,7 +169,7 @@ static void PlayPlaylistSong()
DoPlaySong(); DoPlaySong();
_song_is_active = true; _song_is_active = true;
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9); SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
} }
void ResetMusic() void ResetMusic()
@ -600,7 +600,7 @@ struct MusicWindow : public Window {
case MW_SHUFFLE: // toggle shuffle case MW_SHUFFLE: // toggle shuffle
msf.shuffle ^= 1; msf.shuffle ^= 1;
this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle); this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle);
this->InvalidateWidget(MW_SHUFFLE); this->SetWidgetDirty(MW_SHUFFLE);
StopMusic(); StopMusic();
SelectSongToPlay(); SelectSongToPlay();
this->SetDirty(); this->SetDirty();
@ -623,7 +623,7 @@ struct MusicWindow : public Window {
#if 0 #if 0
virtual void OnTick() virtual void OnTick()
{ {
this->InvalidateWidget(MW_GAUGE); this->SetWidgetDirty(MW_GAUGE);
} }
#endif #endif
}; };

@ -441,7 +441,7 @@ static NetworkClientSocket *NetworkAllocClient(SOCKET s)
ci->client_playas = COMPANY_INACTIVE_CLIENT; ci->client_playas = COMPANY_INACTIVE_CLIENT;
ci->join_date = _date; ci->join_date = _date;
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
} }
return cs; return cs;
@ -489,7 +489,7 @@ void NetworkCloseClient(NetworkClientSocket *cs, bool error)
if (cs->status >= STATUS_AUTH) _network_game_info.clients_on--; if (cs->status >= STATUS_AUTH) _network_game_info.clients_on--;
_network_clients_connected--; _network_clients_connected--;
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
} }
delete cs->GetInfo(); delete cs->GetInfo();

@ -124,7 +124,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_COMPANY_INFO)
*/ */
Packet *p; Packet *p;
_network_join_status = NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO; _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); p = NetworkSend_Init(PACKET_CLIENT_COMPANY_INFO);
MY_CLIENT->Send_Packet(p); MY_CLIENT->Send_Packet(p);
@ -145,7 +145,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN)
Packet *p; Packet *p;
_network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING; _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 = NetworkSend_Init(PACKET_CLIENT_JOIN);
p->Send_string(_openttd_revision); 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)); 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; return NETWORK_RECV_STATUS_OKAY;
} }
@ -434,7 +434,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
ci->client_playas = playas; ci->client_playas = playas;
strecpy(ci->client_name, name, lastof(ci->client_name)); strecpy(ci->client_name, name, lastof(ci->client_name));
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
return NETWORK_RECV_STATUS_OKAY; 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)); strecpy(ci->client_name, name, lastof(ci->client_name));
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
return NETWORK_RECV_STATUS_OKAY; 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_status = NETWORK_JOIN_STATUS_WAITING;
_network_join_waiting = p->Recv_uint8(); _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 ;) */ /* 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..." ); 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; if (_network_join_bytes_total == 0) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
_network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING; _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 */ /* The first packet does not contain any more data */
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
@ -615,7 +615,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
} }
_network_join_bytes = ftell(file_pointer); _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 */ /* Check if this was the last packet */
@ -623,7 +623,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
fclose(file_pointer); fclose(file_pointer);
_network_join_status = NETWORK_JOIN_STATUS_PROCESSING; _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 */ /* The map is done downloading, load it */
if (!SafeSaveOrLoad("network_client.tmp", SL_LOAD, GM_NORMAL, AUTOSAVE_DIR)) { 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; delete ci;
} }
InvalidateWindow(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
return NETWORK_RECV_STATUS_OKAY; 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); 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 */ /* If we come here it means we could not locate the client.. strange :s */
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
@ -808,7 +808,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_JOIN)
if (ci != NULL) if (ci != NULL)
NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, ci->client_name); 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; 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) DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_UPDATE)
{ {
_network_company_passworded = p->Recv_uint16(); _network_company_passworded = p->Recv_uint16();
InvalidateWindowClasses(WC_COMPANY); SetWindowClassesDirty(WC_COMPANY);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }

@ -95,17 +95,17 @@ public:
case CONTENT_TYPE_AI: case CONTENT_TYPE_AI:
case CONTENT_TYPE_AI_LIBRARY: case CONTENT_TYPE_AI_LIBRARY:
AI::Rescan(); AI::Rescan();
InvalidateWindowClasses(WC_AI_DEBUG); SetWindowClassesDirty(WC_AI_DEBUG);
break; break;
case CONTENT_TYPE_BASE_GRAPHICS: case CONTENT_TYPE_BASE_GRAPHICS:
BaseGraphics::FindSets(); BaseGraphics::FindSets();
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
break; break;
case CONTENT_TYPE_BASE_SOUNDS: case CONTENT_TYPE_BASE_SOUNDS:
BaseSounds::FindSets(); BaseSounds::FindSets();
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
break; break;
case CONTENT_TYPE_NEWGRF: case CONTENT_TYPE_NEWGRF:

@ -1203,7 +1203,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password)); strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password));
} else { } else {
int32 value = atoi(str); int32 value = atoi(str);
this->InvalidateWidget(this->widget_id); this->SetWidgetDirty(this->widget_id);
switch (this->widget_id) { switch (this->widget_id) {
default: NOT_REACHED(); default: NOT_REACHED();
case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break;

@ -1733,7 +1733,7 @@ void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded)
if (NetworkCompanyIsPassworded(company_id) == passworded) return; if (NetworkCompanyIsPassworded(company_id) == passworded) return;
SB(_network_company_passworded, company_id, 1, !!passworded); SB(_network_company_passworded, company_id, 1, !!passworded);
InvalidateWindowClasses(WC_COMPANY); SetWindowClassesDirty(WC_COMPANY);
NetworkClientSocket *cs; NetworkClientSocket *cs;
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {

@ -557,5 +557,5 @@ void IndustryProductionCallback(Industry *ind, int reason)
SB(object.callback_param2, 24, 8, again); SB(object.callback_param2, 24, 8, again);
} }
InvalidateWindow(WC_INDUSTRY_VIEW, ind->index); SetWindowDirty(WC_INDUSTRY_VIEW, ind->index);
} }

@ -690,7 +690,7 @@ void AddNewsItem(StringID string, NewsSubtype subtype, NewsReferenceType reftype
ni->next = NULL; ni->next = NULL;
_latest_news = ni; _latest_news = ni;
InvalidateWindow(WC_MESSAGE_HISTORY, 0); SetWindowDirty(WC_MESSAGE_HISTORY, 0);
} }
/** Delete a news item from the queue */ /** Delete a news item from the queue */
@ -724,7 +724,7 @@ static void DeleteNewsItem(NewsItem *ni)
_total_news--; _total_news--;
delete ni; delete ni;
InvalidateWindow(WC_MESSAGE_HISTORY, 0); SetWindowDirty(WC_MESSAGE_HISTORY, 0);
} }
void DeleteVehicleNews(VehicleID vid, StringID news) void DeleteVehicleNews(VehicleID vid, StringID news)
@ -1160,7 +1160,7 @@ struct MessageOptionsWindow : Window {
case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off
_news_ticker_sound ^= 1; _news_ticker_sound ^= 1;
this->OnInvalidateData(0); this->OnInvalidateData(0);
this->InvalidateWidget(widget); this->SetWidgetDirty(widget);
break; break;
default: { // Clicked on the [<] .. [>] widgets default: { // Clicked on the [<] .. [>] widgets

@ -602,7 +602,7 @@ int ttd_main(int argc, char *argv[])
/* Initialize FreeType */ /* Initialize FreeType */
InitFreeType(); InitFreeType();
/* This must be done early, since functions use the InvalidateWindow* calls */ /* This must be done early, since functions use the SetWindowDirty* calls */
InitWindowSystem(); InitWindowSystem();
/* Look for the sounds before the graphics. Otherwise none would be set and /* Look for the sounds before the graphics. Otherwise none would be set and

@ -179,7 +179,7 @@ Order::Order(uint32 packed)
*/ */
void InvalidateVehicleOrder(const Vehicle *v, int data) void InvalidateVehicleOrder(const Vehicle *v, int data)
{ {
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
if (data != 0) { if (data != 0) {
/* Calls SetDirty() too */ /* Calls SetDirty() too */
@ -188,8 +188,8 @@ void InvalidateVehicleOrder(const Vehicle *v, int data)
return; return;
} }
InvalidateWindow(WC_VEHICLE_ORDERS, v->index); SetWindowDirty(WC_VEHICLE_ORDERS, v->index);
InvalidateWindow(WC_VEHICLE_TIMETABLE, 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 */ /* 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_AIRCRAFT) SetWindowClassesDirty(WC_AIRCRAFT_LIST);
if (v->type == VEH_SHIP) InvalidateWindowClasses(WC_SHIPS_LIST); if (v->type == VEH_SHIP) SetWindowClassesDirty(WC_SHIPS_LIST);
return CommandCost(); 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 && if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
v->current_order.GetDestination() == destination) { v->current_order.GetDestination() == destination) {
order->MakeDummy(); order->MakeDummy();
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
} }
/* Clear the order from the order-list */ /* Clear the order from the order-list */
@ -1806,7 +1806,7 @@ bool ProcessOrders(Vehicle *v)
case VEH_AIRCRAFT: case VEH_AIRCRAFT:
case VEH_SHIP: case VEH_SHIP:
InvalidateWindowClasses(GetWindowClassForVehicleType(v->type)); SetWindowClassesDirty(GetWindowClassForVehicleType(v->type));
break; break;
} }

@ -456,7 +456,7 @@ private:
*/ */
void OrderClick_Goto(int i) void OrderClick_Goto(int i)
{ {
this->InvalidateWidget(ORDER_WIDGET_GOTO); this->SetWidgetDirty(ORDER_WIDGET_GOTO);
this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) { if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
_place_clicked_vehicle = NULL; _place_clicked_vehicle = NULL;
@ -521,7 +521,7 @@ private:
*/ */
void OrderClick_Conditional(int i) void OrderClick_Conditional(int i)
{ {
this->InvalidateWidget(ORDER_WIDGET_GOTO); this->SetWidgetDirty(ORDER_WIDGET_GOTO);
this->LowerWidget(ORDER_WIDGET_GOTO); this->LowerWidget(ORDER_WIDGET_GOTO);
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this); SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this);
this->goto_type = OPOS_CONDITIONAL; this->goto_type = OPOS_CONDITIONAL;
@ -560,7 +560,7 @@ private:
non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS; 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)); 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->RaiseWidget(ORDER_WIDGET_GOTO);
this->InvalidateWidget(ORDER_WIDGET_GOTO); this->SetWidgetDirty(ORDER_WIDGET_GOTO);
} }
virtual void OnMouseLoop() virtual void OnMouseLoop()
@ -1233,7 +1233,7 @@ public:
for (uint i = 0; i < this->widget_count; i++) { for (uint i = 0; i < this->widget_count; i++) {
if (this->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { if (this->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) {
this->RaiseWidget(i); this->RaiseWidget(i);
this->InvalidateWidget(i); this->SetWidgetDirty(i);
} }
} }
} }

@ -245,20 +245,20 @@ struct OskWindow : public Window {
QueryStringBaseWindow *w = dynamic_cast<QueryStringBaseWindow*>(this->parent); QueryStringBaseWindow *w = dynamic_cast<QueryStringBaseWindow*>(this->parent);
if (w != NULL) w->OnOSKInput(this->text_btn); if (w != NULL) w->OnOSKInput(this->text_btn);
this->InvalidateWidget(OSK_WIDGET_TEXT); this->SetWidgetDirty(OSK_WIDGET_TEXT);
if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn);
} }
virtual void OnMouseLoop() virtual void OnMouseLoop()
{ {
this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); this->qs->HandleEditBox(this, OSK_WIDGET_TEXT);
/* make the caret of the parent window also blink */ /* 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) virtual void OnInvalidateData(int)
{ {
this->InvalidateWidget(OSK_WIDGET_TEXT); this->SetWidgetDirty(OSK_WIDGET_TEXT);
} }
}; };

@ -314,7 +314,7 @@ static void ToggleRailButton_Remove(Window *w)
{ {
DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowById(WC_SELECT_STATION, 0);
w->ToggleWidgetLoweredState(RTW_REMOVE); w->ToggleWidgetLoweredState(RTW_REMOVE);
w->InvalidateWidget(RTW_REMOVE); w->SetWidgetDirty(RTW_REMOVE);
_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
SetSelectionRed(_remove_button_clicked); SetSelectionRed(_remove_button_clicked);
} }
@ -795,7 +795,7 @@ struct BuildRailToolbarWindow : Window {
{ {
this->RaiseButtons(); this->RaiseButtons();
this->DisableWidget(RTW_REMOVE); this->DisableWidget(RTW_REMOVE);
this->InvalidateWidget(RTW_REMOVE); this->SetWidgetDirty(RTW_REMOVE);
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
@ -1601,14 +1601,14 @@ public:
case BSW_DRAG_SIGNALS_DENSITY_DECREASE: case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
if (_settings_client.gui.drag_signals_density > 1) { if (_settings_client.gui.drag_signals_density > 1) {
_settings_client.gui.drag_signals_density--; _settings_client.gui.drag_signals_density--;
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
} }
break; break;
case BSW_DRAG_SIGNALS_DENSITY_INCREASE: case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
if (_settings_client.gui.drag_signals_density < 20) { if (_settings_client.gui.drag_signals_density < 20) {
_settings_client.gui.drag_signals_density++; _settings_client.gui.drag_signals_density++;
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
} }
break; break;

@ -267,7 +267,7 @@ typedef void OnButtonClick(Window *w);
static void ToggleRoadButton_Remove(Window *w) static void ToggleRoadButton_Remove(Window *w)
{ {
w->ToggleWidgetLoweredState(RTW_REMOVE); w->ToggleWidgetLoweredState(RTW_REMOVE);
w->InvalidateWidget(RTW_REMOVE); w->SetWidgetDirty(RTW_REMOVE);
_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
SetSelectionRed(_remove_button_clicked); SetSelectionRed(_remove_button_clicked);
} }
@ -447,12 +447,12 @@ struct BuildRoadToolbarWindow : Window {
switch (clicked_widget) { switch (clicked_widget) {
case RTW_REMOVE: case RTW_REMOVE:
this->RaiseWidget(RTW_ONE_WAY); this->RaiseWidget(RTW_ONE_WAY);
this->InvalidateWidget(RTW_ONE_WAY); this->SetWidgetDirty(RTW_ONE_WAY);
break; break;
case RTW_ONE_WAY: case RTW_ONE_WAY:
this->RaiseWidget(RTW_REMOVE); this->RaiseWidget(RTW_REMOVE);
this->InvalidateWidget(RTW_REMOVE); this->SetWidgetDirty(RTW_REMOVE);
break; break;
case RTW_BUS_STATION: case RTW_BUS_STATION:
@ -533,8 +533,8 @@ struct BuildRoadToolbarWindow : Window {
RTW_REMOVE, RTW_REMOVE,
RTW_ONE_WAY, RTW_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
this->InvalidateWidget(RTW_REMOVE); this->SetWidgetDirty(RTW_REMOVE);
this->InvalidateWidget(RTW_ONE_WAY); this->SetWidgetDirty(RTW_ONE_WAY);
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);

@ -295,7 +295,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0); InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner); SetWindowDirty(WC_COMPANY, v->owner);
if (IsLocalCompany()) { if (IsLocalCompany()) {
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
} }
@ -620,7 +620,7 @@ static void RoadVehCrash(RoadVehicle *v)
ClearSlot(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)); 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) if (v->breakdowns_since_last_service != 255)
v->breakdowns_since_last_service++; v->breakdowns_since_last_service++;
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? 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->tick_counter & 1) == 0) {
if (--v->breakdown_delay == 0) { if (--v->breakdown_delay == 0) {
v->breakdown_ctr = 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 */ /* Update statusbar only if speed has changed to save CPU time */
if (oldspeed != v->cur_speed) { if (oldspeed != v->cur_speed) {
if (_settings_client.gui.vehicle_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); 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, /* 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 * suddenly moved farther away, we continue our normal
* schedule? */ * schedule? */
v->current_order.MakeDummy(); 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; return;
} }
@ -1863,7 +1863,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE); v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = rfdd.tile; 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() void RoadVehicle::OnNewDay()
@ -1957,8 +1957,8 @@ void RoadVehicle::OnNewDay()
SubtractMoneyFromCompanyFract(this->owner, cost); SubtractMoneyFromCompanyFract(this->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
InvalidateWindowClasses(WC_ROADVEH_LIST); SetWindowClassesDirty(WC_ROADVEH_LIST);
} }
Trackdir RoadVehicle::GetVehicleTrackdir() const 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.Truncate((v->cargo_type == new_cid) ? capacity : 0);
v->cargo_type = new_cid; v->cargo_type = new_cid;
v->cargo_subtype = new_subtype; v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0); InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
} }
} }

@ -664,13 +664,13 @@ static bool RedrawScreen(int32 p1)
static bool InvalidateDetailsWindow(int32 p1) static bool InvalidateDetailsWindow(int32 p1)
{ {
InvalidateWindowClasses(WC_VEHICLE_DETAILS); SetWindowClassesDirty(WC_VEHICLE_DETAILS);
return true; return true;
} }
static bool InvalidateStationBuildWindow(int32 p1) static bool InvalidateStationBuildWindow(int32 p1)
{ {
InvalidateWindow(WC_BUILD_STATION, 0); SetWindowDirty(WC_BUILD_STATION, 0);
return true; return true;
} }
@ -752,7 +752,7 @@ static bool TrainAccelerationModelChanged(int32 p1)
static bool DragSignalsDensityChanged(int32) static bool DragSignalsDensityChanged(int32)
{ {
InvalidateWindow(WC_BUILD_SIGNAL, 0); SetWindowDirty(WC_BUILD_SIGNAL, 0);
return true; return true;
} }
@ -820,7 +820,7 @@ static bool DifficultyChange(int32)
ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0);
_settings_newgame.difficulty.diff_level = 3; _settings_newgame.difficulty.diff_level = 3;
} }
InvalidateWindowClasses(WC_SELECT_GAME); SetWindowClassesDirty(WC_SELECT_GAME);
} else { } else {
_settings_game.difficulty.diff_level = 3; _settings_game.difficulty.diff_level = 3;
} }
@ -1446,7 +1446,7 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
GamelogStopAction(); GamelogStopAction();
} }
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
} }
return CommandCost(); return CommandCost();
@ -1480,7 +1480,7 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32
return CommandCost(); return CommandCost();
} }
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
} }
return CommandCost(); return CommandCost();
@ -1509,7 +1509,7 @@ bool SetSettingValue(uint index, int32 value)
Write_ValidateSetting(var2, sd, value); Write_ValidateSetting(var2, sd, value);
} }
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); 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; return true;
} }

@ -384,7 +384,7 @@ struct GameOptionsWindow : Window {
case GOW_TOWNNAME_DROPDOWN: // Town names case GOW_TOWNNAME_DROPDOWN: // Town names
if (_game_mode == GM_MENU || Town::GetNumItems() == 0) { if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
this->opt->game_creation.town_name = index; this->opt->game_creation.town_name = index;
InvalidateWindow(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, 0);
} }
break; break;

@ -146,14 +146,14 @@ static void CheckIfShipNeedsService(Vehicle *v)
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
if (v->current_order.IsType(OT_GOTO_DEPOT)) { if (v->current_order.IsType(OT_GOTO_DEPOT)) {
v->current_order.MakeDummy(); 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; return;
} }
v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE); v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE);
v->dest_tile = depot->xy; 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 Money Ship::GetRunningCost() const
@ -181,9 +181,9 @@ void Ship::OnNewDay()
SubtractMoneyFromCompanyFract(this->owner, cost); SubtractMoneyFromCompanyFract(this->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
/* we need this for the profit */ /* we need this for the profit */
InvalidateWindowClasses(WC_SHIPS_LIST); SetWindowClassesDirty(WC_SHIPS_LIST);
} }
Trackdir Ship::GetVehicleTrackdir() const Trackdir Ship::GetVehicleTrackdir() const
@ -212,8 +212,8 @@ static void HandleBrokenShip(Vehicle *v)
if (v->breakdowns_since_last_service != 255) if (v->breakdowns_since_last_service != 255)
v->breakdowns_since_last_service++; v->breakdowns_since_last_service++;
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
@ -229,7 +229,7 @@ static void HandleBrokenShip(Vehicle *v)
if (!(v->tick_counter & 1)) { if (!(v->tick_counter & 1)) {
if (!--v->breakdown_delay) { if (!--v->breakdown_delay) {
v->breakdown_ctr = 0; 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) void RecalcShipStuff(Vehicle *v)
{ {
v->UpdateViewport(false, true); v->UpdateViewport(false, true);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
} }
static const TileIndexDiffC _ship_leave_depot_offs[] = { static const TileIndexDiffC _ship_leave_depot_offs[] = {
@ -324,7 +324,7 @@ static void CheckShipLeaveDepot(Ship *v)
PlayShipSound(v); PlayShipSound(v);
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClasses(WC_SHIPS_LIST); SetWindowClassesDirty(WC_SHIPS_LIST);
} }
static bool ShipAccelerate(Vehicle *v) static bool ShipAccelerate(Vehicle *v)
@ -338,7 +338,7 @@ static bool ShipAccelerate(Vehicle *v)
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_settings_client.gui.vehicle_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);
} }
/* Decrease somewhat when turning */ /* Decrease somewhat when turning */
@ -627,7 +627,7 @@ static void ShipController(Ship *v)
* always skip ahead. */ * always skip ahead. */
if (v->current_order.IsType(OT_LEAVESTATION)) { if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free(); 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) { } else if (v->dest_tile != 0) {
/* We have a target, let's see if we reached it... */ /* We have a target, let's see if we reached it... */
if (v->current_order.IsType(OT_GOTO_WAYPOINT) && 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); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_SHIPS_LIST, 0); InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner); SetWindowDirty(WC_COMPANY, v->owner);
if (IsLocalCompany()) if (IsLocalCompany())
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window 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->cargo_subtype = new_subtype;
v->colourmap = PAL_NONE; // invalidate vehicle colour map v->colourmap = PAL_NONE; // invalidate vehicle colour map
v->InvalidateNewGRFCacheOfChain(); v->InvalidateNewGRFCacheOfChain();
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_SHIPS_LIST, 0); InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
} }

@ -176,7 +176,7 @@ struct SignListWindow : Window, SignList {
if (data == 0) { // New or deleted sign. if (data == 0) { // New or deleted sign.
this->signs.ForceRebuild(); this->signs.ForceRebuild();
this->BuildSignsList(); this->BuildSignsList();
this->InvalidateWidget(SLW_CAPTION); this->SetWidgetDirty(SLW_CAPTION);
this->vscroll.SetCount(this->signs.Length()); this->vscroll.SetCount(this->signs.Length());
} else { // Change of sign contents. } else { // Change of sign contents.
this->signs.ForceResort(); this->signs.ForceResort();
@ -272,7 +272,7 @@ struct SignWindow : QueryStringBaseWindow, SignList {
this->cur_sign = si->index; this->cur_sign = si->index;
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_LENGTH_SIGN_NAME_PIXELS); 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); this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
} }

@ -427,7 +427,7 @@ void Station::UpdateVirtCoord()
SetDParam(1, this->facilities); SetDParam(1, this->facilities);
this->sign.UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION); 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. */ /** 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 */ /* 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) static void UpdateStationSignCoord(BaseStation *st)
@ -1153,7 +1153,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 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; 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 we deleted the whole station, delete the train facility. */
if (st->train_station.tile == INVALID_TILE) { if (st->train_station.tile == INVALID_TILE) {
st->facilities &= ~FACIL_TRAIN; st->facilities &= ~FACIL_TRAIN;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
st->UpdateVirtCoord(); st->UpdateVirtCoord();
DeleteStationIfEmpty(st); DeleteStationIfEmpty(st);
} }
@ -1345,7 +1345,7 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3
for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) { for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) {
Station *st = *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->MarkTilesDirty(false);
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
} }
@ -1433,7 +1433,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
st->speclist = NULL; st->speclist = NULL;
st->cached_anim_triggers = 0; st->cached_anim_triggers = 0;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
st->UpdateVirtCoord(); st->UpdateVirtCoord();
DeleteStationIfEmpty(st); DeleteStationIfEmpty(st);
} }
@ -1636,7 +1636,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 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; return cost;
} }
@ -1701,7 +1701,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
pred->next = cur_stop->next; pred->next = cur_stop->next;
} }
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
delete cur_stop; delete cur_stop;
/* Make sure no vehicle is going to the old roadstop */ /* 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(); st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 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) { 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->airport_tile = INVALID_TILE;
st->facilities &= ~FACIL_AIRPORT; 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) { if (_settings_game.economy.station_noise_level) {
InvalidateWindow(WC_TOWN_VIEW, st->town->index); SetWindowDirty(WC_TOWN_VIEW, st->town->index);
} }
st->UpdateVirtCoord(); st->UpdateVirtCoord();
@ -2211,7 +2211,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 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); return CommandCost(EXPENSES_CONSTRUCTION, _price.build_dock);
@ -2246,7 +2246,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
st->dock_tile = INVALID_TILE; st->dock_tile = INVALID_TILE;
st->facilities &= ~FACIL_DOCK; st->facilities &= ~FACIL_DOCK;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
st->UpdateVirtCoord(); st->UpdateVirtCoord();
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st); DeleteStationIfEmpty(st);
@ -2823,9 +2823,9 @@ static void UpdateStationRating(Station *st)
StationID index = st->index; StationID index = st->index;
if (waiting_changed) { if (waiting_changed) {
InvalidateWindow(WC_STATION_VIEW, index); // update whole window SetWindowDirty(WC_STATION_VIEW, index); // update whole window
} else { } 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); StationAnimationTrigger(st, st->xy, STAT_ANIM_NEW_CARGO, type);
InvalidateWindow(WC_STATION_VIEW, st->index); SetWindowDirty(WC_STATION_VIEW, st->index);
st->MarkTilesDirty(true); st->MarkTilesDirty(true);
} }

@ -254,7 +254,7 @@ protected:
this->last_station = NULL; this->last_station = NULL;
/* Set the modified widget dirty */ /* Set the modified widget dirty */
this->InvalidateWidget(SLW_LIST); this->SetWidgetDirty(SLW_LIST);
} }
public: public:
@ -969,7 +969,7 @@ struct StationViewWindow : public Window {
for (CargoID c = 0; c < NUM_CARGO; c++) { for (CargoID c = 0; c < NUM_CARGO; c++) {
if (this->cargo_rows[c] == row) { if (this->cargo_rows[c] == row) {
ToggleBit(this->cargo, c); ToggleBit(this->cargo, c);
this->InvalidateWidget(SVW_WAITING); this->SetWidgetDirty(SVW_WAITING);
break; break;
} }
} }

@ -171,14 +171,14 @@ struct StatusBarWindow : Window {
if (this->ticker_scroll < TICKER_STOP) { // Scrolling text if (this->ticker_scroll < TICKER_STOP) { // Scrolling text
this->ticker_scroll += COUNTER_STEP; 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 if (this->reminder_timeout > REMINDER_STOP) { // Red blot to show there are new unread newsmessages
this->reminder_timeout -= COUNTER_STEP; this->reminder_timeout -= COUNTER_STEP;
} else if (this->reminder_timeout < REMINDER_STOP) { } else if (this->reminder_timeout < REMINDER_STOP) {
this->reminder_timeout = REMINDER_STOP; this->reminder_timeout = REMINDER_STOP;
this->InvalidateWidget(SBW_MIDDLE); this->SetWidgetDirty(SBW_MIDDLE);
} }
} }
}; };

@ -734,7 +734,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons
if (this->IsWidgetLowered(i)) { if (this->IsWidgetLowered(i)) {
this->RaiseWidget(i); this->RaiseWidget(i);
this->InvalidateWidget(i); this->SetWidgetDirty(i);
} }
} }
} }

@ -40,7 +40,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
v->current_order.wait_time = 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_TIMETABLE);
ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
} }
InvalidateWindow(WC_VEHICLE_TIMETABLE, v2->index); SetWindowDirty(WC_VEHICLE_TIMETABLE, v2->index);
} }
return CommandCost(); return CommandCost();
@ -241,6 +241,6 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
v->lateness_counter -= (timetabled - time_taken); v->lateness_counter -= (timetabled - time_taken);
for (v = v->FirstShared(); v != NULL; v = v->NextShared()) { for (v = v->FirstShared(); v != NULL; v = v->NextShared()) {
InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index); SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
} }
} }

@ -1120,12 +1120,12 @@ struct MainToolbarWindow : Window {
{ {
if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_mode) { if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_mode) {
this->ToggleWidgetLoweredState(TBN_PAUSE); this->ToggleWidgetLoweredState(TBN_PAUSE);
this->InvalidateWidget(TBN_PAUSE); this->SetWidgetDirty(TBN_PAUSE);
} }
if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) { if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) {
this->ToggleWidgetLoweredState(TBN_FASTFORWARD); 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++) { for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) {
if (this->IsWidgetLowered(i)) { if (this->IsWidgetLowered(i)) {
this->RaiseWidget(i); this->RaiseWidget(i);
this->InvalidateWidget(i); this->SetWidgetDirty(i);
} }
} }
} }
@ -1393,8 +1393,8 @@ public:
virtual void OnTimeout() virtual void OnTimeout()
{ {
this->SetWidgetsLoweredState(false, TBSE_DATEBACKWARD, TBSE_DATEFORWARD, WIDGET_LIST_END); this->SetWidgetsLoweredState(false, TBSE_DATEBACKWARD, TBSE_DATEFORWARD, WIDGET_LIST_END);
this->InvalidateWidget(TBSE_DATEBACKWARD); this->SetWidgetDirty(TBSE_DATEBACKWARD);
this->InvalidateWidget(TBSE_DATEFORWARD); this->SetWidgetDirty(TBSE_DATEFORWARD);
} }
virtual void OnTick() virtual void OnTick()

@ -339,7 +339,7 @@ void Town::UpdateVirtCoord()
this->sign.UpdatePosition(pt.x, pt.y - 24, this->sign.UpdatePosition(pt.x, pt.y - 24,
_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN); _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. */ /** 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) static void ChangePopulation(Town *t, int mod)
{ {
t->population += mod; t->population += mod;
InvalidateWindow(WC_TOWN_VIEW, t->index); SetWindowDirty(WC_TOWN_VIEW, t->index);
t->UpdateVirtCoord(); t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1); InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
@ -2471,7 +2471,7 @@ static void TownActionBribe(Town *t)
*/ */
if (t->ratings[_current_company] > RATING_BRIBE_DOWN_TO) { if (t->ratings[_current_company] > RATING_BRIBE_DOWN_TO) {
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 { } else {
ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM, DC_EXEC); 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) { if (flags & DC_EXEC) {
_town_action_proc[p2](t); _town_action_proc[p2](t);
InvalidateWindow(WC_TOWN_AUTHORITY, p1); SetWindowDirty(WC_TOWN_AUTHORITY, p1);
} }
return cost; return cost;
@ -2616,7 +2616,7 @@ static void UpdateTownGrowRate(Town *t)
t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM); 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); ClrBit(t->flags, TOWN_IS_FUNDED);
if (_settings_game.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return; 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->max_mail = t->new_max_mail; t->new_max_mail = 0;
t->act_mail = t->new_act_mail; t->new_act_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) static void UpdateTownUnwanted(Town *t)
@ -2821,7 +2821,7 @@ void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
} else { } else {
SetBit(t->have_ratings, _current_company); SetBit(t->have_ratings, _current_company);
t->ratings[_current_company] = rating; t->ratings[_current_company] = rating;
InvalidateWindow(WC_TOWN_AUTHORITY, t->index); SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
} }
} }

@ -130,8 +130,8 @@ void TrainPowerChanged(Train *v)
v->tcache.cached_power = total_power; v->tcache.cached_power = total_power;
v->tcache.cached_max_te = max_te; v->tcache.cached_max_te = max_te;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); 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()) { if (v->IsFrontEngine()) {
UpdateTrainAcceleration(v); 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); TrainConsistChanged(v->First(), false);
UpdateTrainGroupID(v->First()); UpdateTrainGroupID(v->First());
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
if (IsLocalCompany()) { if (IsLocalCompany()) {
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window 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); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_TRAINS_LIST, 0); InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner); SetWindowDirty(WC_COMPANY, v->owner);
if (IsLocalCompany()) { if (IsLocalCompany()) {
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window 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); UpdateTrainGroupID(src_head);
if (src_head->IsFrontEngine()) { if (src_head->IsFrontEngine()) {
/* Update the refit button and window */ /* Update the refit button and window */
InvalidateWindow(WC_VEHICLE_REFIT, src_head->index); SetWindowDirty(WC_VEHICLE_REFIT, src_head->index);
InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH);
} }
/* Update the depot window */ /* Update the depot window */
InvalidateWindow(WC_VEHICLE_DEPOT, src_head->tile); SetWindowDirty(WC_VEHICLE_DEPOT, src_head->tile);
} }
if (dst_head != NULL) { if (dst_head != NULL) {
@ -1419,11 +1419,11 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
UpdateTrainGroupID(dst_head); UpdateTrainGroupID(dst_head);
if (dst_head->IsFrontEngine()) { if (dst_head->IsFrontEngine()) {
/* Update the refit button and window */ /* Update the refit button and window */
InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH);
InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index); SetWindowDirty(WC_VEHICLE_REFIT, dst_head->index);
} }
/* Update the depot window */ /* Update the depot window */
InvalidateWindow(WC_VEHICLE_DEPOT, dst_head->tile); SetWindowDirty(WC_VEHICLE_DEPOT, dst_head->tile);
} }
InvalidateWindowClassesData(WC_TRAINS_LIST, 0); 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_DETAILS, first->index);
DeleteWindowById(WC_VEHICLE_TIMETABLE, 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); InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
} }
@ -1546,7 +1546,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
NormaliseTrainConsist(first); NormaliseTrainConsist(first);
TrainConsistChanged(first, false); TrainConsistChanged(first, false);
UpdateTrainGroupID(first); 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); NormaliseTrainConsist(first);
TrainConsistChanged(first, false); TrainConsistChanged(first, false);
UpdateTrainGroupID(first); UpdateTrainGroupID(first);
InvalidateWindow(WC_VEHICLE_REFIT, first->index); SetWindowDirty(WC_VEHICLE_REFIT, first->index);
} }
} break; } break;
} }
@ -1633,7 +1633,7 @@ static inline void SetLastSpeed(Train *v, int spd)
if (spd != old) { if (spd != old) {
v->tcache.last_speed = spd; v->tcache.last_speed = spd;
if (_settings_client.gui.vehicle_speed || (old == 0) != (spd == 0)) { 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; v->subspeed = 0;
SetLastSpeed(v, 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 we are inside a depot after reversing, don't bother with path reserving. */
if (v->track == TRACK_BIT_DEPOT) { if (v->track == TRACK_BIT_DEPOT) {
/* Can't be stuck here as inside a depot is always a safe tile. */ /* 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); ClrBit(v->flags, VRF_TRAIN_STUCK);
return; return;
} }
@ -2018,8 +2018,8 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ToggleBit(v->flags, VRF_REVERSE_DIRECTION); ToggleBit(v->flags, VRF_REVERSE_DIRECTION);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
} }
} else { } else {
/* turn the whole train around */ /* turn the whole train around */
@ -2148,8 +2148,8 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
v->cargo_type = new_cid; v->cargo_type = new_cid;
v->cargo_cap = amount; v->cargo_cap = amount;
v->cargo_subtype = new_subtype; v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClassesData(WC_TRAINS_LIST, 0); 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 the train got no power, then keep it in the depot */
if (v->tcache.cached_power == 0) { if (v->tcache.cached_power == 0) {
v->vehstatus |= VS_STOPPED; v->vehstatus |= VS_STOPPED;
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
return true; return true;
} }
@ -2446,7 +2446,7 @@ static bool CheckTrainStayInDepot(Train *v)
if (v->force_proceed == 0) { if (v->force_proceed == 0) {
/* force proceed was not pressed */ /* force proceed was not pressed */
if (++v->load_unload_time_rem < 37) { if (++v->load_unload_time_rem < 37) {
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
return true; 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); seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) { if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) {
/* Full and no PBS signal in block or depot reserved, can't exit. */ /* Full and no PBS signal in block or depot reserved, can't exit. */
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
return true; return true;
} }
} else { } else {
@ -2474,7 +2474,7 @@ static bool CheckTrainStayInDepot(Train *v)
/* Only leave when we can reserve a path to our destination. */ /* Only leave when we can reserve a path to our destination. */
if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == 0) { if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == 0) {
/* No path and no force proceed. */ /* No path and no force proceed. */
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
MarkTrainAsStuck(v); MarkTrainAsStuck(v);
return true; return true;
} }
@ -2483,7 +2483,7 @@ static bool CheckTrainStayInDepot(Train *v)
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile); if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile);
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
v->PlayLeaveStationSound(); v->PlayLeaveStationSound();
v->track = TRACK_BIT_X; 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 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)) { if (origin.okay && (v->tile != origin.tile || first_tile_okay)) {
/* Can't be stuck then. */ /* 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); ClrBit(v->flags, VRF_TRAIN_STUCK);
return true; 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)) { if (HasBit(v->flags, VRF_TRAIN_STUCK)) {
v->load_unload_time_rem = 0; 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); ClrBit(v->flags, VRF_TRAIN_STUCK);
return true; return true;
@ -3536,11 +3536,11 @@ static void SetVehicleCrashed(Train *v)
v->crash_anim_pos++; v->crash_anim_pos++;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
if (v->track == TRACK_BIT_DEPOT) { if (v->track == TRACK_BIT_DEPOT) {
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
} }
InvalidateWindowClassesData(WC_TRAINS_LIST, 0); 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 - /* Update the depot window if the first vehicle is in depot -
* if v == first, then it is updated in PreDestructor() */ * if v == first, then it is updated in PreDestructor() */
if (first->track == TRACK_BIT_DEPOT) { 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)) { if (state >= 4440 && !(v->tick_counter & 0x1F)) {
bool ret = v->Next() != NULL; bool ret = v->Next() != NULL;
DeleteLastWagon(v); DeleteLastWagon(v);
InvalidateWindow(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN); SetWindowDirty(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN);
return ret; return ret;
} }
@ -4137,8 +4137,8 @@ static void HandleBrokenTrain(Train *v)
if (v->breakdowns_since_last_service != 255) if (v->breakdowns_since_last_service != 255)
v->breakdowns_since_last_service++; v->breakdowns_since_last_service++;
InvalidateWindow(WC_VEHICLE_VIEW, v->index); SetWindowDirty(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ? SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
@ -4154,7 +4154,7 @@ static void HandleBrokenTrain(Train *v)
if (!(v->tick_counter & 3)) { if (!(v->tick_counter & 3)) {
if (!--v->breakdown_delay) { if (!--v->breakdown_delay) {
v->breakdown_ctr = 0; 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) { if (v->force_proceed != 0) {
v->force_proceed--; v->force_proceed--;
ClrBit(v->flags, VRF_TRAIN_STUCK); 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? */ /* train is broken down? */
@ -4399,13 +4399,13 @@ static bool TrainLocoHandler(Train *v, bool mode)
if (v->force_proceed == 0) return true; if (v->force_proceed == 0) return true;
ClrBit(v->flags, VRF_TRAIN_STUCK); ClrBit(v->flags, VRF_TRAIN_STUCK);
v->load_unload_time_rem = 0; 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)) { if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free(); 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; 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' */ /* 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)) { 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; 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 * suddenly moved farther away, we continue our normal
* schedule? */ * schedule? */
v->current_order.MakeDummy(); 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; return;
} }
@ -4536,7 +4536,7 @@ static void CheckIfTrainNeedsService(Train *v)
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE); v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = tfdd.tile; 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() void Train::OnNewDay()
@ -4566,8 +4566,8 @@ void Train::OnNewDay()
SubtractMoneyFromCompanyFract(this->owner, cost); SubtractMoneyFromCompanyFract(this->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
} }
} else if (this->IsEngine()) { } else if (this->IsEngine()) {
/* Also age engines that aren't front engines */ /* Also age engines that aren't front engines */

@ -117,7 +117,7 @@ public:
if (IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN))) { if (IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN))) {
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} else { } else {
this->InvalidateWidget(TTW_WIDGET_BUTTONS); this->SetWidgetDirty(TTW_WIDGET_BUTTONS);
} }
} }
} }

@ -152,7 +152,7 @@ public:
virtual void OnTimeout() virtual void OnTimeout()
{ {
this->RaiseWidget(BTW_MANY_RANDOM); this->RaiseWidget(BTW_MANY_RANDOM);
this->InvalidateWidget(BTW_MANY_RANDOM); this->SetWidgetDirty(BTW_MANY_RANDOM);
} }
virtual void OnPlaceObjectAbort() virtual void OnPlaceObjectAbort()

@ -69,7 +69,7 @@ static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags)
DoClearSquare(t + TileDiffXY(1, 0)); DoClearSquare(t + TileDiffXY(1, 0));
DoClearSquare(t + TileDiffXY(1, 1)); DoClearSquare(t + TileDiffXY(1, 1));
c->location_of_HQ = INVALID_TILE; // reset HQ position c->location_of_HQ = INVALID_TILE; // reset HQ position
InvalidateWindow(WC_COMPANY, cid); SetWindowDirty(WC_COMPANY, cid);
CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, cid); CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, cid);
} }
@ -127,7 +127,7 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
MakeCompanyHQ(tile, _current_company); MakeCompanyHQ(tile, _current_company);
UpdateCompanyHQ(c, score); UpdateCompanyHQ(c, score);
InvalidateWindow(WC_COMPANY, c->index); SetWindowDirty(WC_COMPANY, c->index);
} }
return cost; return cost;
@ -291,7 +291,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags)
TownID town = GetStatueTownID(tile); TownID town = GetStatueTownID(tile);
ClrBit(Town::Get(town)->statues, GetTileOwner(tile)); ClrBit(Town::Get(town)->statues, GetTileOwner(tile));
InvalidateWindow(WC_TOWN_AUTHORITY, town); SetWindowDirty(WC_TOWN_AUTHORITY, town);
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@ -486,7 +486,7 @@ static void ChangeTileOwner_Unmovable(TileIndex tile, Owner old_owner, Owner new
DoClearSquare(tile); DoClearSquare(tile);
} }
InvalidateWindow(WC_TOWN_AUTHORITY, town); SetWindowDirty(WC_TOWN_AUTHORITY, town);
} else { } else {
DoClearSquare(tile); DoClearSquare(tile);
} }

@ -87,7 +87,7 @@ void VehicleServiceInDepot(Vehicle *v)
v->date_of_last_service = _date; v->date_of_last_service = _date;
v->breakdowns_since_last_service = 0; v->breakdowns_since_last_service = 0;
v->reliability = Engine::Get(v->engine_type)->reliability; 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 bool Vehicle::NeedsServicing() const
@ -517,7 +517,7 @@ void Vehicle::PreDestructor()
DeleteWindowById(WC_VEHICLE_REFIT, this->index); DeleteWindowById(WC_VEHICLE_REFIT, this->index);
DeleteWindowById(WC_VEHICLE_DETAILS, this->index); DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index); DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
InvalidateWindow(WC_COMPANY, this->owner); SetWindowDirty(WC_COMPANY, this->owner);
} }
InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type), 0); InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type), 0);
@ -824,7 +824,7 @@ Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y)
void DecreaseVehicleValue(Vehicle *v) void DecreaseVehicleValue(Vehicle *v)
{ {
v->value -= v->value >> 8; v->value -= v->value >> 8;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
} }
static const byte _breakdown_chance[64] = { static const byte _breakdown_chance[64] = {
@ -844,7 +844,7 @@ void CheckVehicleBreakdown(Vehicle *v)
/* decrease reliability */ /* decrease reliability */
v->reliability = rel = max((rel_old = v->reliability) - v->reliability_spd_dec, 0); 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) || if (v->breakdown_ctr != 0 || (v->vehstatus & VS_STOPPED) ||
_settings_game.difficulty.vehicle_breakdowns < 1 || _settings_game.difficulty.vehicle_breakdowns < 1 ||
@ -884,7 +884,7 @@ void AgeVehicle(Vehicle *v)
v->reliability_spd_dec <<= 1; 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 */ /* 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; 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) { switch (v->type) {
case VEH_TRAIN: { case VEH_TRAIN: {
Train *t = Train::From(v); Train *t = Train::From(v);
InvalidateWindowClasses(WC_TRAINS_LIST); SetWindowClassesDirty(WC_TRAINS_LIST);
/* Clear path reservation */ /* Clear path reservation */
SetDepotReservation(t->tile, false); SetDepotReservation(t->tile, false);
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile); if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile);
@ -973,17 +973,17 @@ void VehicleEnterDepot(Vehicle *v)
} }
case VEH_ROAD: case VEH_ROAD:
InvalidateWindowClasses(WC_ROADVEH_LIST); SetWindowClassesDirty(WC_ROADVEH_LIST);
break; break;
case VEH_SHIP: case VEH_SHIP:
InvalidateWindowClasses(WC_SHIPS_LIST); SetWindowClassesDirty(WC_SHIPS_LIST);
Ship::From(v)->state = TRACK_BIT_DEPOT; Ship::From(v)->state = TRACK_BIT_DEPOT;
RecalcShipStuff(v); RecalcShipStuff(v);
break; break;
case VEH_AIRCRAFT: case VEH_AIRCRAFT:
InvalidateWindowClasses(WC_AIRCRAFT_LIST); SetWindowClassesDirty(WC_AIRCRAFT_LIST);
HandleAircraftEnterHangar(Aircraft::From(v)); HandleAircraftEnterHangar(Aircraft::From(v));
break; break;
default: NOT_REACHED(); 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 */ * 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); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
} }
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
v->vehstatus |= VS_HIDDEN; v->vehstatus |= VS_HIDDEN;
v->cur_speed = 0; v->cur_speed = 0;
@ -1004,7 +1004,7 @@ void VehicleEnterDepot(Vehicle *v)
TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT); TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
if (v->current_order.IsType(OT_GOTO_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); const Order *real_order = v->GetOrder(v->cur_order_index);
Order t = v->current_order; Order t = v->current_order;
@ -1435,10 +1435,10 @@ void Vehicle::BeginLoading()
PrepareUnload(this); PrepareUnload(this);
InvalidateWindow(GetWindowClassForVehicleType(this->type), this->owner); SetWindowDirty(GetWindowClassForVehicleType(this->type), this->owner);
InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
InvalidateWindow(WC_STATION_VIEW, this->last_station_visited); SetWindowDirty(WC_STATION_VIEW, this->last_station_visited);
Station::Get(this->last_station_visited)->MarkTilesDirty(true); Station::Get(this->last_station_visited)->MarkTilesDirty(true);
this->cur_speed = 0; this->cur_speed = 0;
@ -1517,7 +1517,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
this->current_order.SetDepotOrderType(ODTF_MANUAL); this->current_order.SetDepotOrderType(ODTF_MANUAL);
this->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT); 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(); return CommandCost();
} }
@ -1529,7 +1529,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->IncrementOrderIndex(); if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->IncrementOrderIndex();
this->current_order.MakeDummy(); 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(); return CommandCost();
} }
@ -1546,7 +1546,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
this->dest_tile = location; this->dest_tile = location;
this->current_order.MakeGoToDepot(destination, ODTF_MANUAL); this->current_order.MakeGoToDepot(destination, ODTF_MANUAL);
if (!(command & DEPOT_SERVICE)) this->current_order.SetDepotActionType(ODATFB_HALT); 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 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); 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 /* Code ripped from CmdStartStopTrain. Can't call it, because of
* ownership problems, so we'll duplicate some code, for now */ * ownership problems, so we'll duplicate some code, for now */
v->vehstatus |= VS_STOPPED; 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);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
} }
} }
@ -1672,7 +1672,7 @@ void VehiclesYearlyLoop()
v->profit_last_year = v->profit_this_year; v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0; v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
} }
} }
} }

@ -106,9 +106,9 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
v->vehstatus ^= VS_STOPPED; v->vehstatus ^= VS_STOPPED;
if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly' if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly'
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClasses(GetWindowClassForVehicleType(v->type)); SetWindowClassesDirty(GetWindowClassForVehicleType(v->type));
} }
return CommandCost(); return CommandCost();
} }
@ -567,7 +567,7 @@ CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
v->service_interval = serv_int; v->service_interval = serv_int;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
} }
return CommandCost(); return CommandCost();

@ -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) 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->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->SetWidgetDisabledState(widget_zoom_out, vp->zoom == ZOOM_LVL_MAX);
w->InvalidateWidget(widget_zoom_out); w->SetWidgetDirty(widget_zoom_out);
} }
/** /**

@ -837,8 +837,8 @@ static void FloodVehicle(Vehicle *v)
return; return;
} }
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED)); AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED));
SetDParam(0, pass); SetDParam(0, pass);

@ -991,7 +991,7 @@ inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, ui
* Mark the widget as 'dirty' (in need of repaint). * Mark the widget as 'dirty' (in need of repaint).
* @param w Window owning the widget. * @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_left = w->left + this->pos_x;
int abs_top = w->top + this->pos_y; int abs_top = w->top + this->pos_y;
@ -1654,7 +1654,7 @@ void NWidgetSpacer::Draw(const Window *w)
/* Spacer widget is never visible. */ /* Spacer widget is never visible. */
} }
void NWidgetSpacer::Invalidate(const Window *w) const void NWidgetSpacer::SetDirty(const Window *w) const
{ {
/* Spacer widget never need repainting. */ /* Spacer widget never need repainting. */
} }

@ -209,7 +209,7 @@ public:
inline uint GetVerticalStepSize(SizingType sizing) const; inline uint GetVerticalStepSize(SizingType sizing) const;
virtual void Draw(const Window *w) = 0; 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. WidgetType type; ///< Type of the widget / nested widget.
bool fill_x; ///< Allow horizontal filling from initial size. bool fill_x; ///< Allow horizontal filling from initial size.
@ -458,7 +458,7 @@ public:
/* virtual */ void FillNestedArray(NWidgetCore **array, uint length); /* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
/* virtual */ void Draw(const Window *w); /* 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); /* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
}; };

@ -104,7 +104,7 @@ struct DropdownWindow : Window {
Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num); Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num);
if (w2 != NULL) { if (w2 != NULL) {
w2->RaiseWidget(this->parent_button); w2->RaiseWidget(this->parent_button);
w2->InvalidateWidget(this->parent_button); w2->SetWidgetDirty(this->parent_button);
} }
DeleteDropDownList(this->list); DeleteDropDownList(this->list);
@ -252,7 +252,7 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u
DeleteWindowById(WC_DROPDOWN_MENU, 0); DeleteWindowById(WC_DROPDOWN_MENU, 0);
w->LowerWidget(button); w->LowerWidget(button);
w->InvalidateWidget(button); w->SetWidgetDirty(button);
/* Our parent's button widget is used to determine where to place the drop /* Our parent's button widget is used to determine where to place the drop
* down list window. */ * down list window. */

@ -107,9 +107,9 @@ void SetFocusedWindow(Window *w)
if (_focused_window != NULL) { if (_focused_window != NULL) {
if (_focused_window->focused_widget != NULL) { if (_focused_window->focused_widget != NULL) {
uint focused_widget_id = _focused_window->focused_widget - _focused_window->widget; 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 */ /* Remember which window was previously focused */
@ -152,7 +152,7 @@ bool Window::SetFocusedWidget(byte widget_index)
if (this->focused_widget != NULL) { if (this->focused_widget != NULL) {
/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */ /* 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]; this->focused_widget = &this->widget[widget_index];
return true; return true;
@ -167,7 +167,7 @@ bool Window::SetFocusedWidget(byte widget_index)
if (this->nested_array[widget_index] == this->nested_focus) return false; 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. */ /* 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]; this->nested_focus = this->nested_array[widget_index];
return true; return true;
@ -246,7 +246,7 @@ void Window::RaiseButtons(bool autoraise)
for (uint i = 0; i < this->widget_count; i++) { for (uint i = 0; i < this->widget_count; i++) {
if ((!autoraise || (this->widget[i].type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) { if ((!autoraise || (this->widget[i].type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) {
this->RaiseWidget(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++) { 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)) { if (this->nested_array[i] != NULL && (!autoraise || (this->nested_array[i]->type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) {
this->RaiseWidget(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. * Invalidate a widget, i.e. mark it as being changed and in need of redraw.
* @param widget_index the widget to 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) { if (this->widget != NULL) {
const Widget *wi = &this->widget[widget_index]; 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); 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->LowerWidget(widget);
this->flags4 |= WF_TIMEOUT_BEGIN; 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. */ * we assume that that button is used to resize to the left. */
int left_pos = (wi != NULL) ? wi->left : nw->pos_x; int left_pos = (wi != NULL) ? wi->left : nw->pos_x;
StartWindowSizing(w, left_pos < (w->width / 2)); StartWindowSizing(w, left_pos < (w->width / 2));
w->InvalidateWidget(widget_index); w->SetWidgetDirty(widget_index);
return; return;
} }
if ((w->desc_flags & WDF_STICKY_BUTTON) && widget_type == WWT_STICKYBOX) { if ((w->desc_flags & WDF_STICKY_BUTTON) && widget_type == WWT_STICKYBOX) {
w->flags4 ^= WF_STICKY; w->flags4 ^= WF_STICKY;
w->InvalidateWidget(widget_index); w->SetWidgetDirty(widget_index);
return; return;
} }
} }
@ -2440,7 +2440,7 @@ void UpdateWindows()
* @param cls Window class * @param cls Window class
* @param number Window number in that class * @param number Window number in that class
*/ */
void InvalidateWindow(WindowClass cls, WindowNumber number) void SetWindowDirty(WindowClass cls, WindowNumber number)
{ {
const Window *w; const Window *w;
FOR_ALL_WINDOWS_FROM_BACK(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 number Window number in that class
* @param widget_index Index number of the widget that needs repainting * @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; const Window *w;
FOR_ALL_WINDOWS_FROM_BACK(w) { FOR_ALL_WINDOWS_FROM_BACK(w) {
if (w->window_class == cls && w->window_number == number) { 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) * Mark all windows of a particular class as dirty (in need of repainting)
* @param cls Window class * @param cls Window class
*/ */
void InvalidateWindowClasses(WindowClass cls) void SetWindowClassesDirty(WindowClass cls)
{ {
Window *w; Window *w;
FOR_ALL_WINDOWS_FROM_BACK(w) { FOR_ALL_WINDOWS_FROM_BACK(w) {

@ -39,9 +39,9 @@ void ShowVitalWindows();
void ReInitAllWindows(); void ReInitAllWindows();
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index); void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index);
void InvalidateWindow(WindowClass cls, WindowNumber number); void SetWindowDirty(WindowClass cls, WindowNumber number);
void InvalidateWindowClasses(WindowClass cls); void SetWindowClassesDirty(WindowClass cls);
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true); void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true);
void DeleteWindowByClass(WindowClass cls); void DeleteWindowByClass(WindowClass cls);

@ -619,7 +619,7 @@ public:
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...); void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...);
void CDECL SetWidgetsLoweredState(bool lowered_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 DrawWidgets() const;
void DrawViewport() const; void DrawViewport() const;

Loading…
Cancel
Save