changeset 13034:6eb3f749890a draft

(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
author frosch <frosch@openttd.org>
date Sun, 13 Sep 2009 19:15:59 +0000
parents bc1115a0f463
children 5c7bae21e898
files src/ai/ai_gui.cpp src/aircraft_cmd.cpp src/bridge_gui.cpp src/cheat_gui.cpp src/company_cmd.cpp src/company_gui.cpp src/console_cmds.cpp src/console_gui.cpp src/date.cpp src/depot_gui.cpp src/economy.cpp src/engine.cpp src/genworld_gui.cpp src/graph_gui.cpp src/group_cmd.cpp src/group_gui.cpp src/industry_cmd.cpp src/industry_gui.cpp src/intro_gui.cpp src/misc_cmd.cpp src/misc_gui.cpp src/music_gui.cpp src/network/network.cpp src/network/network_client.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/network/network_server.cpp src/newgrf_industries.cpp src/news_gui.cpp src/openttd.cpp src/order_cmd.cpp src/order_gui.cpp src/osk_gui.cpp src/rail_gui.cpp src/road_gui.cpp src/roadveh_cmd.cpp src/settings.cpp src/settings_gui.cpp src/ship_cmd.cpp src/signs_gui.cpp src/station_cmd.cpp src/station_gui.cpp src/statusbar_gui.cpp src/terraform_gui.cpp src/timetable_cmd.cpp src/toolbar_gui.cpp src/town_cmd.cpp src/train_cmd.cpp src/transparency_gui.cpp src/tree_gui.cpp src/unmovable_cmd.cpp src/vehicle.cpp src/vehicle_cmd.cpp src/viewport.cpp src/water_cmd.cpp src/widget.cpp src/widget_type.h src/widgets/dropdown.cpp src/window.cpp src/window_func.h src/window_gui.h
diffstat 61 files changed, 323 insertions(+), 323 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -153,7 +153,7 @@
 			for (int i = 0; i < this->selected; i++) it++;
 			AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion());
 		}
-		InvalidateWindow(WC_GAME_OPTIONS, 0);
+		SetWindowDirty(WC_GAME_OPTIONS, 0);
 	}
 
 	virtual void OnClick(Point pt, int widget)
@@ -767,7 +767,7 @@
 			this->vscroll.SetCount(scroll_count);
 
 			/* We need a repaint */
-			this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
+			this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
 		}
 
 		if (log == NULL) return;
@@ -783,8 +783,8 @@
 				this->vscroll.SetPosition(scroll_pos);
 
 				/* We need a repaint */
-				this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
-				this->InvalidateWidget(AID_WIDGET_LOG_PANEL);
+				this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
+				this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
 			}
 		}
 		this->last_vscroll_pos = this->vscroll.GetPosition();
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -433,7 +433,7 @@
 
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
-		InvalidateWindow(WC_COMPANY, v->owner);
+		SetWindowDirty(WC_COMPANY, v->owner);
 		if (IsLocalCompany())
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window
 
@@ -580,8 +580,8 @@
 		v->cargo_subtype = new_subtype;
 		v->colourmap = PAL_NONE; // invalidate vehicle colour map
 		v->InvalidateNewGRFCacheOfChain();
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
 	}
 
@@ -606,10 +606,10 @@
 //		printf("targetairport = %d, st->index = %d\n", v->targetairport, st->index);
 //		v->targetairport = st->index;
 		v->current_order.MakeGoToDepot(st->index, ODTFB_SERVICE);
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	} else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
 		v->current_order.MakeDummy();
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 }
 
@@ -639,8 +639,8 @@
 
 	SubtractMoneyFromCompanyFract(this->owner, cost);
 
-	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
-	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+	SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
+	SetWindowClassesDirty(WC_AIRCRAFT_LIST);
 }
 
 static void HelicopterTickHandler(Aircraft *v)
@@ -816,7 +816,7 @@
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
 		if (_settings_client.gui.vehicle_speed)
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	/* Adjust distance moved by plane speed setting */
@@ -1219,8 +1219,8 @@
 
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
-		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 	}
 }
 
@@ -1316,7 +1316,7 @@
 
 	CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
 
-	InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+	SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 
 	uint amt = 2;
 	if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count();
@@ -1439,7 +1439,7 @@
 	VehicleServiceInDepot(v);
 	SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
 	InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
-	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+	SetWindowClassesDirty(WC_AIRCRAFT_LIST);
 }
 
 /** Checks if an aircraft should head towards a hangar because it needs replacement
@@ -1550,7 +1550,7 @@
 				v->date_of_last_service = _date;
 				v->breakdowns_since_last_service = 0;
 				v->reliability = Engine::Get(v->engine_type)->reliability;
-				InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+				SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 			}
 		}
 		return;
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -121,8 +121,8 @@
 		this->nested_array[BBSW_DROPDOWN_CRITERIA]->widget_data = this->sorter_names[this->bridges->SortType()];
 
 		/* Set the modified widgets dirty */
-		this->InvalidateWidget(BBSW_DROPDOWN_CRITERIA);
-		this->InvalidateWidget(BBSW_BRIDGE_LIST);
+		this->SetWidgetDirty(BBSW_DROPDOWN_CRITERIA);
+		this->SetWidgetDirty(BBSW_BRIDGE_LIST);
 	}
 
 public:
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -67,7 +67,7 @@
  */
 static int32 ClickSetProdCheat(int32 p1, int32 p2)
 {
-	InvalidateWindowClasses(WC_INDUSTRY_VIEW);
+	SetWindowClassesDirty(WC_INDUSTRY_VIEW);
 	return p1;
 }
 
@@ -104,7 +104,7 @@
 
 	SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
 	EnginesMonthlyLoop();
-	InvalidateWindow(WC_STATUS_BAR, 0);
+	SetWindowDirty(WC_STATUS_BAR, 0);
 	InvalidateWindowClassesData(WC_BUILD_STATION, 0);
 	ResetSignalVariant();
 	return _cur_year;
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -149,8 +149,8 @@
 {
 	CompanyID cid = company->index;
 
-	if (cid == _local_company) InvalidateWindow(WC_STATUS_BAR, 0);
-	InvalidateWindow(WC_FINANCES, cid);
+	if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
+	SetWindowDirty(WC_FINANCES, cid);
 }
 
 bool CheckCompanyHasMoney(CommandCost cost)
@@ -459,9 +459,9 @@
 
 	GeneratePresidentName(c);
 
-	InvalidateWindow(WC_GRAPH_LEGEND, 0);
-	InvalidateWindow(WC_TOOLBAR_MENU, 0);
-	InvalidateWindow(WC_CLIENT_LIST, 0);
+	SetWindowDirty(WC_GRAPH_LEGEND, 0);
+	SetWindowDirty(WC_TOOLBAR_MENU, 0);
+	SetWindowDirty(WC_CLIENT_LIST, 0);
 
 	if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
 
@@ -595,7 +595,7 @@
 	FOR_ALL_COMPANIES(c) {
 		memmove(&c->yearly_expenses[1], &c->yearly_expenses[0], sizeof(c->yearly_expenses) - sizeof(c->yearly_expenses[0]));
 		memset(&c->yearly_expenses[0], 0, sizeof(c->yearly_expenses[0]));
-		InvalidateWindow(WC_FINANCES, c->index);
+		SetWindowDirty(WC_FINANCES, c->index);
 	}
 
 	if (_settings_client.gui.show_finances && _local_company != COMPANY_SPECTATOR) {
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -1665,7 +1665,7 @@
 					SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
 					SetTileSelectSize(2, 2);
 					this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ);
-					this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ);
+					this->SetWidgetDirty(CW_WIDGET_BUILD_VIEW_HQ);
 				} else {
 					if (_ctrl_pressed) {
 						ShowExtraViewPortWindow(tile);
@@ -1680,7 +1680,7 @@
 				SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
 				SetTileSelectSize(2, 2);
 				this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
-				this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ);
+				this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ);
 				break;
 
 			case CW_WIDGET_BUY_SHARE:
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -383,7 +383,7 @@
 	}
 
 	IConsoleClearBuffer();
-	InvalidateWindow(WC_CONSOLE, 0);
+	SetWindowDirty(WC_CONSOLE, 0);
 	return true;
 }
 
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -141,7 +141,7 @@
 	_iconsole_cmdline.width = 0;
 	_iconsole_cmdline.caretpos = 0;
 	_iconsole_cmdline.caretxoffs = 0;
-	InvalidateWindow(WC_CONSOLE, 0);
+	SetWindowDirty(WC_CONSOLE, 0);
 }
 
 static inline void IConsoleResetHistoryPos() {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
@@ -470,5 +470,5 @@
 void IConsoleGUIPrint(ConsoleColour colour_code, char *str)
 {
 	new IConsoleLine(str, (TextColour)colour_code);
-	InvalidateWindow(WC_CONSOLE, 0);
+	SetWindowDirty(WC_CONSOLE, 0);
 }
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -240,7 +240,7 @@
 		RedrawAutosave();
 	}
 
-	InvalidateWindowClasses(WC_CHEATS);
+	SetWindowClassesDirty(WC_CHEATS);
 	CompaniesMonthlyLoop();
 	SubsidyMonthlyLoop();
 	EnginesMonthlyLoop();
@@ -264,7 +264,7 @@
 	DisasterDailyLoop();
 	IndustryDailyLoop();
 
-	InvalidateWindowWidget(WC_STATUS_BAR, 0, 0);
+	SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0);
 	EnginesDailyLoop();
 }
 
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -726,7 +726,7 @@
 				break;
 
 			case DEPOT_WIDGET_CLONE: // Clone button
-				this->InvalidateWidget(DEPOT_WIDGET_CLONE);
+				this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
 				this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE);
 
 				if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) {
@@ -850,11 +850,11 @@
 	{
 		/* abort clone */
 		this->RaiseWidget(DEPOT_WIDGET_CLONE);
-		this->InvalidateWidget(DEPOT_WIDGET_CLONE);
+		this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
 
 		/* abort drag & drop */
 		this->sel = INVALID_VEHICLE;
-		this->InvalidateWidget(DEPOT_WIDGET_MATRIX);
+		this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
 	};
 
 	/* check if a vehicle in a depot was clicked.. */
@@ -935,11 +935,11 @@
 	{
 		if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) {
 			this->RaiseWidget(DEPOT_WIDGET_SELL);
-			this->InvalidateWidget(DEPOT_WIDGET_SELL);
+			this->SetWidgetDirty(DEPOT_WIDGET_SELL);
 		}
 		if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL_CHAIN)) {
 			this->RaiseWidget(DEPOT_WIDGET_SELL_CHAIN);
-			this->InvalidateWidget(DEPOT_WIDGET_SELL_CHAIN);
+			this->SetWidgetDirty(DEPOT_WIDGET_SELL_CHAIN);
 		}
 	}
 
@@ -955,7 +955,7 @@
 	{
 		if (this->sel != INVALID_VEHICLE) {
 			_cursor.vehchain = _ctrl_pressed;
-			this->InvalidateWidget(DEPOT_WIDGET_MATRIX);
+			this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
 			return ES_HANDLED;
 		}
 
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -281,7 +281,7 @@
 		c->old_economy[0].company_value = CalculateCompanyValue(c);
 	}
 
-	InvalidateWindow(WC_PERFORMANCE_DETAIL, 0);
+	SetWindowDirty(WC_PERFORMANCE_DETAIL, 0);
 	return score;
 }
 
@@ -576,12 +576,12 @@
 		CompanyCheckBankrupt(c);
 	}
 
-	InvalidateWindow(WC_INCOME_GRAPH, 0);
-	InvalidateWindow(WC_OPERATING_PROFIT, 0);
-	InvalidateWindow(WC_DELIVERED_CARGO, 0);
-	InvalidateWindow(WC_PERFORMANCE_HISTORY, 0);
-	InvalidateWindow(WC_COMPANY_VALUE, 0);
-	InvalidateWindow(WC_COMPANY_LEAGUE, 0);
+	SetWindowDirty(WC_INCOME_GRAPH, 0);
+	SetWindowDirty(WC_OPERATING_PROFIT, 0);
+	SetWindowDirty(WC_DELIVERED_CARGO, 0);
+	SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
+	SetWindowDirty(WC_COMPANY_VALUE, 0);
+	SetWindowDirty(WC_COMPANY_LEAGUE, 0);
 }
 
 /**
@@ -670,10 +670,10 @@
 		cs->current_payment = ((int64)cs->initial_payment * _economy.inflation_payment) >> 16;
 	}
 
-	InvalidateWindowClasses(WC_BUILD_VEHICLE);
-	InvalidateWindowClasses(WC_REPLACE_VEHICLE);
-	InvalidateWindowClasses(WC_VEHICLE_DETAILS);
-	InvalidateWindow(WC_PAYMENT_RATES, 0);
+	SetWindowClassesDirty(WC_BUILD_VEHICLE);
+	SetWindowClassesDirty(WC_REPLACE_VEHICLE);
+	SetWindowClassesDirty(WC_VEHICLE_DETAILS);
+	SetWindowDirty(WC_PAYMENT_RATES, 0);
 }
 
 static void CompaniesPayInterest()
@@ -966,7 +966,7 @@
 		if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) {
 			IndustryProductionCallback(i, 0);
 		} else {
-			InvalidateWindow(WC_INDUSTRY_VIEW, i->index);
+			SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
 		}
 	} else {
 		for (uint cargo_index = 0; cargo_index < lengthof(i->incoming_cargo_waiting); cargo_index++) {
@@ -1354,13 +1354,13 @@
 	}
 
 	if (result != 0) {
-		InvalidateWindow(GetWindowClassForVehicleType(v->type), v->owner);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(GetWindowClassForVehicleType(v->type), v->owner);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 		st->MarkTilesDirty(true);
 		v->MarkDirty();
 
-		if (result & 2) InvalidateWindow(WC_STATION_VIEW, last_visited);
+		if (result & 2) SetWindowDirty(WC_STATION_VIEW, last_visited);
 	}
 }
 
@@ -1495,7 +1495,7 @@
 				break;
 			}
 		}
-		InvalidateWindow(WC_COMPANY, p1);
+		SetWindowDirty(WC_COMPANY, p1);
 	}
 	return cost;
 }
@@ -1525,7 +1525,7 @@
 		OwnerByte *b = c->share_owners;
 		while (*b != _current_company) b++; // share owners is guaranteed to contain company
 		*b = COMPANY_SPECTATOR;
-		InvalidateWindow(WC_COMPANY, p1);
+		SetWindowDirty(WC_COMPANY, p1);
 	}
 	return CommandCost(EXPENSES_OTHER, cost);
 }
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -436,8 +436,8 @@
 		/* Kick this engine out of the lists */
 		AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
 	}
-	InvalidateWindowClasses(WC_BUILD_VEHICLE); // Update to show the new reliability
-	InvalidateWindowClasses(WC_REPLACE_VEHICLE);
+	SetWindowClassesDirty(WC_BUILD_VEHICLE); // Update to show the new reliability
+	SetWindowClassesDirty(WC_REPLACE_VEHICLE);
 }
 
 void SetYearEngineAgingStops()
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -54,8 +54,8 @@
 static inline void SetNewLandscapeType(byte landscape)
 {
 	_settings_newgame.game_creation.landscape = landscape;
-	InvalidateWindowClasses(WC_SELECT_GAME);
-	InvalidateWindowClasses(WC_GENERATE_LANDSCAPE);
+	SetWindowClassesDirty(WC_SELECT_GAME);
+	SetWindowClassesDirty(WC_GENERATE_LANDSCAPE);
 }
 
 enum GenerateLandscapeWindowWidgets {
@@ -802,7 +802,7 @@
 		for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
 			if (this->IsWidgetLowered(*widget)) {
 				this->RaiseWidget(*widget);
-				this->InvalidateWidget(*widget);
+				this->SetWidgetDirty(*widget);
 			}
 		}
 	}
@@ -880,12 +880,12 @@
 
 			switch (this->widget_id) {
 				case GLAND_START_DATE_TEXT:
-					this->InvalidateWidget(GLAND_START_DATE_TEXT);
+					this->SetWidgetDirty(GLAND_START_DATE_TEXT);
 					_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
 					break;
 
 				case GLAND_SNOW_LEVEL_TEXT:
-					this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT);
+					this->SetWidgetDirty(GLAND_SNOW_LEVEL_TEXT);
 					_settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT);
 					break;
 
@@ -936,7 +936,7 @@
 		strecpy(w->name, _file_to_saveload.title, lastof(w->name));
 	}
 
-	InvalidateWindow(WC_GENERATE_LANDSCAPE, mode);
+	SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
 }
 
 void ShowGenerateLandscape()
@@ -1100,12 +1100,12 @@
 
 			switch (this->widget_id) {
 				case CSCEN_START_DATE_TEXT:
-					this->InvalidateWidget(CSCEN_START_DATE_TEXT);
+					this->SetWidgetDirty(CSCEN_START_DATE_TEXT);
 					_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
 					break;
 
 				case CSCEN_FLAT_LAND_HEIGHT_TEXT:
-					this->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT);
+					this->SetWidgetDirty(CSCEN_FLAT_LAND_HEIGHT_TEXT);
 					_settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT);
 					break;
 			}
@@ -1396,7 +1396,7 @@
 		return;
 	}
 
-	InvalidateWindow(WC_GENERATE_PROGRESS_WINDOW, 0);
+	SetWindowDirty(WC_GENERATE_PROGRESS_WINDOW, 0);
 	MarkWholeScreenDirty();
 
 	/* Release the rights to the map generator, and acquire the rights to the
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -87,11 +87,11 @@
 		ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY);
 		this->ToggleWidgetLoweredState(widget);
 		this->SetDirty();
-		InvalidateWindow(WC_INCOME_GRAPH, 0);
-		InvalidateWindow(WC_OPERATING_PROFIT, 0);
-		InvalidateWindow(WC_DELIVERED_CARGO, 0);
-		InvalidateWindow(WC_PERFORMANCE_HISTORY, 0);
-		InvalidateWindow(WC_COMPANY_VALUE, 0);
+		SetWindowDirty(WC_INCOME_GRAPH, 0);
+		SetWindowDirty(WC_OPERATING_PROFIT, 0);
+		SetWindowDirty(WC_DELIVERED_CARGO, 0);
+		SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
+		SetWindowDirty(WC_COMPANY_VALUE, 0);
 	}
 
 	virtual void OnInvalidateData(int data)
@@ -403,7 +403,7 @@
 			Window(desc, window_number), has_negative_values(has_negative_values),
 			format_str_y_axis(format_str_y_axis)
 	{
-		InvalidateWindow(WC_GRAPH_LEGEND, 0);
+		SetWindowDirty(WC_GRAPH_LEGEND, 0);
 		this->num_vert_lines = 24;
 
 		this->graph_location.left   = left;
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -228,7 +228,7 @@
 		}
 
 		/* Update the Replace Vehicle Windows */
-		InvalidateWindow(WC_REPLACE_VEHICLE, v->type);
+		SetWindowDirty(WC_REPLACE_VEHICLE, v->type);
 		InvalidateWindowData(GetWindowClassForVehicleType(v->type), (v->type << 11) | VLW_GROUP_LIST | _current_company);
 	}
 
@@ -362,7 +362,7 @@
 	}
 
 	/* Update the Replace Vehicle Windows */
-	InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
+	SetWindowDirty(WC_REPLACE_VEHICLE, VEH_TRAIN);
 }
 
 
@@ -385,7 +385,7 @@
 	}
 
 	/* 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)
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -676,7 +676,7 @@
 	{
 		/* abort drag & drop */
 		this->vehicle_sel = INVALID_VEHICLE;
-		this->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE);
+		this->SetWidgetDirty(GRP_WIDGET_LIST_VEHICLE);
 	}
 
 	void ShowRenameGroupWindow(GroupID group)
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1894,7 +1894,7 @@
 		}
 	}
 
-	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 */
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -806,7 +806,7 @@
 
 		if (!this->industries.Sort()) return;
 		IndustryDirectoryWindow::last_industry = NULL; // Reset name sorter sort cache
-		this->InvalidateWidget(IDW_INDUSTRY_LIST); // Set the modified widget dirty
+		this->SetWidgetDirty(IDW_INDUSTRY_LIST); // Set the modified widget dirty
 	}
 
 	/**
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -35,7 +35,7 @@
 static inline void SetNewLandscapeType(byte landscape)
 {
 	_settings_newgame.game_creation.landscape = landscape;
-	InvalidateWindowClasses(WC_SELECT_GAME);
+	SetWindowClassesDirty(WC_SELECT_GAME);
 }
 
 enum SelectGameIntroWidgets {
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -354,8 +354,8 @@
 			}
 		}
 
-		InvalidateWindow(WC_STATUS_BAR, 0);
-		InvalidateWindow(WC_MAIN_TOOLBAR, 0);
+		SetWindowDirty(WC_STATUS_BAR, 0);
+		SetWindowDirty(WC_MAIN_TOOLBAR, 0);
 	}
 	return CommandCost();
 }
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1141,25 +1141,25 @@
 		case WKC_RETURN: case WKC_NUM_ENTER: return HEBR_CONFIRM;
 
 		case (WKC_CTRL | 'V'):
-			if (InsertTextBufferClipboard(&this->text)) w->InvalidateWidget(wid);
+			if (InsertTextBufferClipboard(&this->text)) w->SetWidgetDirty(wid);
 			break;
 
 		case (WKC_CTRL | 'U'):
 			DeleteTextBufferAll(&this->text);
-			w->InvalidateWidget(wid);
+			w->SetWidgetDirty(wid);
 			break;
 
 		case WKC_BACKSPACE: case WKC_DELETE:
-			if (DeleteTextBufferChar(&this->text, keycode)) w->InvalidateWidget(wid);
+			if (DeleteTextBufferChar(&this->text, keycode)) w->SetWidgetDirty(wid);
 			break;
 
 		case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME:
-			if (MoveTextBufferPos(&this->text, keycode)) w->InvalidateWidget(wid);
+			if (MoveTextBufferPos(&this->text, keycode)) w->SetWidgetDirty(wid);
 			break;
 
 		default:
 			if (IsValidChar(key, this->afilter)) {
-				if (InsertTextBufferChar(&this->text, key)) w->InvalidateWidget(wid);
+				if (InsertTextBufferChar(&this->text, key)) w->SetWidgetDirty(wid);
 			} else {
 				state = Window::ES_NOT_HANDLED;
 			}
@@ -1171,7 +1171,7 @@
 void QueryString::HandleEditBox(Window *w, int wid)
 {
 	if (HasEditBoxFocus(w, wid) && HandleCaret(&this->text)) {
-		w->InvalidateWidget(wid);
+		w->SetWidgetDirty(wid);
 		/* When we're not the OSK, notify 'our' OSK to redraw the widget,
 		 * so the caret changes appropriately. */
 		if (w->window_class != WC_OSK) {
@@ -1932,7 +1932,7 @@
 						/* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */
 						ttd_strlcpy(this->text.buf, file->title, this->text.maxsize);
 						UpdateTextBufferSize(&this->text);
-						this->InvalidateWidget(SLWW_SAVE_OSK_TITLE);
+						this->SetWidgetDirty(SLWW_SAVE_OSK_TITLE);
 					}
 				} else {
 					/* Changed directory, need repaint. */
@@ -2078,7 +2078,7 @@
 
 void RedrawAutosave()
 {
-	InvalidateWindow(WC_STATUS_BAR, 0);
+	SetWindowDirty(WC_STATUS_BAR, 0);
 }
 
 void SetFiosType(const byte fiostype)
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -148,7 +148,7 @@
 	_music_wnd_cursong = 0;
 	DoStopMusic();
 	_song_is_active = false;
-	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
+	SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
 }
 
 static void PlayPlaylistSong()
@@ -169,7 +169,7 @@
 	DoPlaySong();
 	_song_is_active = true;
 
-	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
+	SetWindowWidgetDirty(WC_MUSIC_WINDOW, 0, 9);
 }
 
 void ResetMusic()
@@ -600,7 +600,7 @@
 			case MW_SHUFFLE: // toggle shuffle
 				msf.shuffle ^= 1;
 				this->SetWidgetLoweredState(MW_SHUFFLE, msf.shuffle);
-				this->InvalidateWidget(MW_SHUFFLE);
+				this->SetWidgetDirty(MW_SHUFFLE);
 				StopMusic();
 				SelectSongToPlay();
 				this->SetDirty();
@@ -623,7 +623,7 @@
 #if 0
 	virtual void OnTick()
 	{
-		this->InvalidateWidget(MW_GAUGE);
+		this->SetWidgetDirty(MW_GAUGE);
 	}
 #endif
 };
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -441,7 +441,7 @@
 		ci->client_playas = COMPANY_INACTIVE_CLIENT;
 		ci->join_date = _date;
 
-		InvalidateWindow(WC_CLIENT_LIST, 0);
+		SetWindowDirty(WC_CLIENT_LIST, 0);
 	}
 
 	return cs;
@@ -489,7 +489,7 @@
 		if (cs->status >= STATUS_AUTH) _network_game_info.clients_on--;
 		_network_clients_connected--;
 
-		InvalidateWindow(WC_CLIENT_LIST, 0);
+		SetWindowDirty(WC_CLIENT_LIST, 0);
 	}
 
 	delete cs->GetInfo();
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -124,7 +124,7 @@
 	 */
 	Packet *p;
 	_network_join_status = NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO;
-	InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
 	p = NetworkSend_Init(PACKET_CLIENT_COMPANY_INFO);
 	MY_CLIENT->Send_Packet(p);
@@ -145,7 +145,7 @@
 
 	Packet *p;
 	_network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING;
-	InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
 	p = NetworkSend_Init(PACKET_CLIENT_JOIN);
 	p->Send_string(_openttd_revision);
@@ -399,7 +399,7 @@
 
 		p->Recv_string(company_info->clients, sizeof(company_info->clients));
 
-		InvalidateWindow(WC_NETWORK_WINDOW, 0);
+		SetWindowDirty(WC_NETWORK_WINDOW, 0);
 
 		return NETWORK_RECV_STATUS_OKAY;
 	}
@@ -434,7 +434,7 @@
 		ci->client_playas = playas;
 		strecpy(ci->client_name, name, lastof(ci->client_name));
 
-		InvalidateWindow(WC_CLIENT_LIST, 0);
+		SetWindowDirty(WC_CLIENT_LIST, 0);
 
 		return NETWORK_RECV_STATUS_OKAY;
 	}
@@ -446,7 +446,7 @@
 
 	strecpy(ci->client_name, name, lastof(ci->client_name));
 
-	InvalidateWindow(WC_CLIENT_LIST, 0);
+	SetWindowDirty(WC_CLIENT_LIST, 0);
 
 	return NETWORK_RECV_STATUS_OKAY;
 }
@@ -560,7 +560,7 @@
 {
 	_network_join_status = NETWORK_JOIN_STATUS_WAITING;
 	_network_join_waiting = p->Recv_uint8();
-	InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
 	/* We are put on hold for receiving the map.. we need GUI for this ;) */
 	DEBUG(net, 1, "The server is currently busy sending the map to someone else, please wait..." );
@@ -601,7 +601,7 @@
 		if (_network_join_bytes_total == 0) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
 		_network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING;
-		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+		SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
 		/* The first packet does not contain any more data */
 		return NETWORK_RECV_STATUS_OKAY;
@@ -615,7 +615,7 @@
 		}
 
 		_network_join_bytes = ftell(file_pointer);
-		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+		SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 	}
 
 	/* Check if this was the last packet */
@@ -623,7 +623,7 @@
 		fclose(file_pointer);
 
 		_network_join_status = NETWORK_JOIN_STATUS_PROCESSING;
-		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+		SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
 		/* The map is done downloading, load it */
 		if (!SafeSaveOrLoad("network_client.tmp", SL_LOAD, GM_NORMAL, AUTOSAVE_DIR)) {
@@ -775,7 +775,7 @@
 		delete ci;
 	}
 
-	InvalidateWindow(WC_CLIENT_LIST, 0);
+	SetWindowDirty(WC_CLIENT_LIST, 0);
 
 	return NETWORK_RECV_STATUS_OKAY;
 }
@@ -794,7 +794,7 @@
 		DEBUG(net, 0, "Unknown client (%d) is leaving the game", client_id);
 	}
 
-	InvalidateWindow(WC_CLIENT_LIST, 0);
+	SetWindowDirty(WC_CLIENT_LIST, 0);
 
 	/* If we come here it means we could not locate the client.. strange :s */
 	return NETWORK_RECV_STATUS_OKAY;
@@ -808,7 +808,7 @@
 	if (ci != NULL)
 		NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, ci->client_name);
 
-	InvalidateWindow(WC_CLIENT_LIST, 0);
+	SetWindowDirty(WC_CLIENT_LIST, 0);
 
 	return NETWORK_RECV_STATUS_OKAY;
 }
@@ -881,7 +881,7 @@
 DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_UPDATE)
 {
 	_network_company_passworded = p->Recv_uint16();
-	InvalidateWindowClasses(WC_COMPANY);
+	SetWindowClassesDirty(WC_COMPANY);
 
 	return NETWORK_RECV_STATUS_OKAY;
 }
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -95,17 +95,17 @@
 				case CONTENT_TYPE_AI:
 				case CONTENT_TYPE_AI_LIBRARY:
 					AI::Rescan();
-					InvalidateWindowClasses(WC_AI_DEBUG);
+					SetWindowClassesDirty(WC_AI_DEBUG);
 					break;
 
 				case CONTENT_TYPE_BASE_GRAPHICS:
 					BaseGraphics::FindSets();
-					InvalidateWindow(WC_GAME_OPTIONS, 0);
+					SetWindowDirty(WC_GAME_OPTIONS, 0);
 					break;
 
 				case CONTENT_TYPE_BASE_SOUNDS:
 					BaseSounds::FindSets();
-					InvalidateWindow(WC_GAME_OPTIONS, 0);
+					SetWindowDirty(WC_GAME_OPTIONS, 0);
 					break;
 
 				case CONTENT_TYPE_NEWGRF:
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1203,7 +1203,7 @@
 			strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password));
 		} else {
 			int32 value = atoi(str);
-			this->InvalidateWidget(this->widget_id);
+			this->SetWidgetDirty(this->widget_id);
 			switch (this->widget_id) {
 				default: NOT_REACHED();
 				case NSSW_CLIENTS_TXT:    _settings_client.network.max_clients    = Clamp(value, 2, MAX_CLIENTS); break;
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1733,7 +1733,7 @@
 	if (NetworkCompanyIsPassworded(company_id) == passworded) return;
 
 	SB(_network_company_passworded, company_id, 1, !!passworded);
-	InvalidateWindowClasses(WC_COMPANY);
+	SetWindowClassesDirty(WC_COMPANY);
 
 	NetworkClientSocket *cs;
 	FOR_ALL_CLIENT_SOCKETS(cs) {
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -557,5 +557,5 @@
 		SB(object.callback_param2, 24, 8, again);
 	}
 
-	InvalidateWindow(WC_INDUSTRY_VIEW, ind->index);
+	SetWindowDirty(WC_INDUSTRY_VIEW, ind->index);
 }
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -690,7 +690,7 @@
 	ni->next = NULL;
 	_latest_news = ni;
 
-	InvalidateWindow(WC_MESSAGE_HISTORY, 0);
+	SetWindowDirty(WC_MESSAGE_HISTORY, 0);
 }
 
 /** Delete a news item from the queue */
@@ -724,7 +724,7 @@
 	_total_news--;
 	delete ni;
 
-	InvalidateWindow(WC_MESSAGE_HISTORY, 0);
+	SetWindowDirty(WC_MESSAGE_HISTORY, 0);
 }
 
 void DeleteVehicleNews(VehicleID vid, StringID news)
@@ -1160,7 +1160,7 @@
 			case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off
 				_news_ticker_sound ^= 1;
 				this->OnInvalidateData(0);
-				this->InvalidateWidget(widget);
+				this->SetWidgetDirty(widget);
 				break;
 
 			default: { // Clicked on the [<] .. [>] widgets
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -602,7 +602,7 @@
 	/* Initialize FreeType */
 	InitFreeType();
 
-	/* This must be done early, since functions use the InvalidateWindow* calls */
+	/* This must be done early, since functions use the SetWindowDirty* calls */
 	InitWindowSystem();
 
 	/* Look for the sounds before the graphics. Otherwise none would be set and
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -179,7 +179,7 @@
  */
 void InvalidateVehicleOrder(const Vehicle *v, int data)
 {
-	InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+	SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 
 	if (data != 0) {
 		/* Calls SetDirty() too */
@@ -188,8 +188,8 @@
 		return;
 	}
 
-	InvalidateWindow(WC_VEHICLE_ORDERS,    v->index);
-	InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index);
+	SetWindowDirty(WC_VEHICLE_ORDERS,    v->index);
+	SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
 }
 
 /**
@@ -795,8 +795,8 @@
 	}
 
 	/* We have an aircraft/ship, they have a mini-schedule, so update them all */
-	if (v->type == VEH_AIRCRAFT) InvalidateWindowClasses(WC_AIRCRAFT_LIST);
-	if (v->type == VEH_SHIP) InvalidateWindowClasses(WC_SHIPS_LIST);
+	if (v->type == VEH_AIRCRAFT) SetWindowClassesDirty(WC_AIRCRAFT_LIST);
+	if (v->type == VEH_SHIP) SetWindowClassesDirty(WC_SHIPS_LIST);
 
 	return CommandCost();
 }
@@ -1515,7 +1515,7 @@
 		if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
 				v->current_order.GetDestination() == destination) {
 			order->MakeDummy();
-			InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+			SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 		}
 
 		/* Clear the order from the order-list */
@@ -1806,7 +1806,7 @@
 
 		case VEH_AIRCRAFT:
 		case VEH_SHIP:
-			InvalidateWindowClasses(GetWindowClassForVehicleType(v->type));
+			SetWindowClassesDirty(GetWindowClassForVehicleType(v->type));
 			break;
 	}
 
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -456,7 +456,7 @@
 	 */
 	void OrderClick_Goto(int i)
 	{
-		this->InvalidateWidget(ORDER_WIDGET_GOTO);
+		this->SetWidgetDirty(ORDER_WIDGET_GOTO);
 		this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
 		if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
 			_place_clicked_vehicle = NULL;
@@ -521,7 +521,7 @@
 	 */
 	void OrderClick_Conditional(int i)
 	{
-		this->InvalidateWidget(ORDER_WIDGET_GOTO);
+		this->SetWidgetDirty(ORDER_WIDGET_GOTO);
 		this->LowerWidget(ORDER_WIDGET_GOTO);
 		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this);
 		this->goto_type = OPOS_CONDITIONAL;
@@ -560,7 +560,7 @@
 			non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS;
 		}
 
-		this->InvalidateWidget(ORDER_WIDGET_NON_STOP);
+		this->SetWidgetDirty(ORDER_WIDGET_NON_STOP);
 		DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4,  CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
 	}
 
@@ -1138,7 +1138,7 @@
 			}
 		}
 		this->RaiseWidget(ORDER_WIDGET_GOTO);
-		this->InvalidateWidget(ORDER_WIDGET_GOTO);
+		this->SetWidgetDirty(ORDER_WIDGET_GOTO);
 	}
 
 	virtual void OnMouseLoop()
@@ -1233,7 +1233,7 @@
 		for (uint i = 0; i < this->widget_count; i++) {
 			if (this->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) {
 				this->RaiseWidget(i);
-				this->InvalidateWidget(i);
+				this->SetWidgetDirty(i);
 			}
 		}
 	}
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -245,20 +245,20 @@
 		QueryStringBaseWindow *w = dynamic_cast<QueryStringBaseWindow*>(this->parent);
 		if (w != NULL) w->OnOSKInput(this->text_btn);
 
-		this->InvalidateWidget(OSK_WIDGET_TEXT);
-		if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn);
+		this->SetWidgetDirty(OSK_WIDGET_TEXT);
+		if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn);
 	}
 
 	virtual void OnMouseLoop()
 	{
 		this->qs->HandleEditBox(this, OSK_WIDGET_TEXT);
 		/* make the caret of the parent window also blink */
-		this->parent->InvalidateWidget(this->text_btn);
+		this->parent->SetWidgetDirty(this->text_btn);
 	}
 
 	virtual void OnInvalidateData(int)
 	{
-		this->InvalidateWidget(OSK_WIDGET_TEXT);
+		this->SetWidgetDirty(OSK_WIDGET_TEXT);
 	}
 };
 
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -314,7 +314,7 @@
 {
 	DeleteWindowById(WC_SELECT_STATION, 0);
 	w->ToggleWidgetLoweredState(RTW_REMOVE);
-	w->InvalidateWidget(RTW_REMOVE);
+	w->SetWidgetDirty(RTW_REMOVE);
 	_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
 	SetSelectionRed(_remove_button_clicked);
 }
@@ -795,7 +795,7 @@
 	{
 		this->RaiseButtons();
 		this->DisableWidget(RTW_REMOVE);
-		this->InvalidateWidget(RTW_REMOVE);
+		this->SetWidgetDirty(RTW_REMOVE);
 
 		DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
 		DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
@@ -1601,14 +1601,14 @@
 			case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
 				if (_settings_client.gui.drag_signals_density > 1) {
 					_settings_client.gui.drag_signals_density--;
-					InvalidateWindow(WC_GAME_OPTIONS, 0);
+					SetWindowDirty(WC_GAME_OPTIONS, 0);
 				}
 				break;
 
 			case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
 				if (_settings_client.gui.drag_signals_density < 20) {
 					_settings_client.gui.drag_signals_density++;
-					InvalidateWindow(WC_GAME_OPTIONS, 0);
+					SetWindowDirty(WC_GAME_OPTIONS, 0);
 				}
 				break;
 
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -267,7 +267,7 @@
 static void ToggleRoadButton_Remove(Window *w)
 {
 	w->ToggleWidgetLoweredState(RTW_REMOVE);
-	w->InvalidateWidget(RTW_REMOVE);
+	w->SetWidgetDirty(RTW_REMOVE);
 	_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
 	SetSelectionRed(_remove_button_clicked);
 }
@@ -447,12 +447,12 @@
 		switch (clicked_widget) {
 			case RTW_REMOVE:
 				this->RaiseWidget(RTW_ONE_WAY);
-				this->InvalidateWidget(RTW_ONE_WAY);
+				this->SetWidgetDirty(RTW_ONE_WAY);
 				break;
 
 			case RTW_ONE_WAY:
 				this->RaiseWidget(RTW_REMOVE);
-				this->InvalidateWidget(RTW_REMOVE);
+				this->SetWidgetDirty(RTW_REMOVE);
 				break;
 
 			case RTW_BUS_STATION:
@@ -533,8 +533,8 @@
 			RTW_REMOVE,
 			RTW_ONE_WAY,
 			WIDGET_LIST_END);
-		this->InvalidateWidget(RTW_REMOVE);
-		this->InvalidateWidget(RTW_ONE_WAY);
+		this->SetWidgetDirty(RTW_REMOVE);
+		this->SetWidgetDirty(RTW_ONE_WAY);
 
 		DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
 		DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -295,7 +295,7 @@
 
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
-		InvalidateWindow(WC_COMPANY, v->owner);
+		SetWindowDirty(WC_COMPANY, v->owner);
 		if (IsLocalCompany()) {
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
 		}
@@ -620,7 +620,7 @@
 
 	ClearSlot(v);
 
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
 	AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING));
 
@@ -663,8 +663,8 @@
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
 
-		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
 			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
@@ -680,7 +680,7 @@
 	if ((v->tick_counter & 1) == 0) {
 		if (--v->breakdown_delay == 0) {
 			v->breakdown_ctr = 0;
-			InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+			SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 		}
 	}
 }
@@ -836,7 +836,7 @@
 	/* Update statusbar only if speed has changed to save CPU time */
 	if (oldspeed != v->cur_speed) {
 		if (_settings_client.gui.vehicle_speed) {
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 	}
 
@@ -1730,7 +1730,7 @@
 		}
 
 		StartRoadVehSound(v);
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	/* Check tile position conditions - i.e. stop position in depot,
@@ -1845,7 +1845,7 @@
 			 * suddenly moved farther away, we continue our normal
 			 * schedule? */
 			v->current_order.MakeDummy();
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 		return;
 	}
@@ -1863,7 +1863,7 @@
 
 	v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
 	v->dest_tile = rfdd.tile;
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 }
 
 void RoadVehicle::OnNewDay()
@@ -1957,8 +1957,8 @@
 
 	SubtractMoneyFromCompanyFract(this->owner, cost);
 
-	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
-	InvalidateWindowClasses(WC_ROADVEH_LIST);
+	SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
+	SetWindowClassesDirty(WC_ROADVEH_LIST);
 }
 
 Trackdir RoadVehicle::GetVehicleTrackdir() const
@@ -2069,8 +2069,8 @@
 			v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
 			v->cargo_type = new_cid;
 			v->cargo_subtype = new_subtype;
-			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+			SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
+			SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 			InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
 		}
 	}
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -664,13 +664,13 @@
 
 static bool InvalidateDetailsWindow(int32 p1)
 {
-	InvalidateWindowClasses(WC_VEHICLE_DETAILS);
+	SetWindowClassesDirty(WC_VEHICLE_DETAILS);
 	return true;
 }
 
 static bool InvalidateStationBuildWindow(int32 p1)
 {
-	InvalidateWindow(WC_BUILD_STATION, 0);
+	SetWindowDirty(WC_BUILD_STATION, 0);
 	return true;
 }
 
@@ -752,7 +752,7 @@
 
 static bool DragSignalsDensityChanged(int32)
 {
-	InvalidateWindow(WC_BUILD_SIGNAL, 0);
+	SetWindowDirty(WC_BUILD_SIGNAL, 0);
 
 	return true;
 }
@@ -820,7 +820,7 @@
 			ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0);
 			_settings_newgame.difficulty.diff_level = 3;
 		}
-		InvalidateWindowClasses(WC_SELECT_GAME);
+		SetWindowClassesDirty(WC_SELECT_GAME);
 	} else {
 		_settings_game.difficulty.diff_level = 3;
 	}
@@ -1446,7 +1446,7 @@
 			GamelogStopAction();
 		}
 
-		InvalidateWindow(WC_GAME_OPTIONS, 0);
+		SetWindowDirty(WC_GAME_OPTIONS, 0);
 	}
 
 	return CommandCost();
@@ -1480,7 +1480,7 @@
 			return CommandCost();
 		}
 
-		InvalidateWindow(WC_GAME_OPTIONS, 0);
+		SetWindowDirty(WC_GAME_OPTIONS, 0);
 	}
 
 	return CommandCost();
@@ -1509,7 +1509,7 @@
 			Write_ValidateSetting(var2, sd, value);
 		}
 		if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
-		InvalidateWindow(WC_GAME_OPTIONS, 0);
+		SetWindowDirty(WC_GAME_OPTIONS, 0);
 		return true;
 	}
 
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -384,7 +384,7 @@
 			case GOW_TOWNNAME_DROPDOWN: // Town names
 				if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
 					this->opt->game_creation.town_name = index;
-					InvalidateWindow(WC_GAME_OPTIONS, 0);
+					SetWindowDirty(WC_GAME_OPTIONS, 0);
 				}
 				break;
 
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -146,14 +146,14 @@
 	if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
 		if (v->current_order.IsType(OT_GOTO_DEPOT)) {
 			v->current_order.MakeDummy();
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 		return;
 	}
 
 	v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE);
 	v->dest_tile = depot->xy;
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 }
 
 Money Ship::GetRunningCost() const
@@ -181,9 +181,9 @@
 
 	SubtractMoneyFromCompanyFract(this->owner, cost);
 
-	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
+	SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
 	/* we need this for the profit */
-	InvalidateWindowClasses(WC_SHIPS_LIST);
+	SetWindowClassesDirty(WC_SHIPS_LIST);
 }
 
 Trackdir Ship::GetVehicleTrackdir() const
@@ -212,8 +212,8 @@
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
 
-		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
 			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
@@ -229,7 +229,7 @@
 	if (!(v->tick_counter & 1)) {
 		if (!--v->breakdown_delay) {
 			v->breakdown_ctr = 0;
-			InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+			SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 		}
 	}
 }
@@ -290,7 +290,7 @@
 void RecalcShipStuff(Vehicle *v)
 {
 	v->UpdateViewport(false, true);
-	InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+	SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 }
 
 static const TileIndexDiffC _ship_leave_depot_offs[] = {
@@ -324,7 +324,7 @@
 	PlayShipSound(v);
 	VehicleServiceInDepot(v);
 	InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
-	InvalidateWindowClasses(WC_SHIPS_LIST);
+	SetWindowClassesDirty(WC_SHIPS_LIST);
 }
 
 static bool ShipAccelerate(Vehicle *v)
@@ -338,7 +338,7 @@
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
 		if (_settings_client.gui.vehicle_speed)
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	/* Decrease somewhat when turning */
@@ -627,7 +627,7 @@
 				 * always skip ahead. */
 				if (v->current_order.IsType(OT_LEAVESTATION)) {
 					v->current_order.Free();
-					InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+					SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 				} else if (v->dest_tile != 0) {
 					/* We have a target, let's see if we reached it... */
 					if (v->current_order.IsType(OT_GOTO_WAYPOINT) &&
@@ -819,7 +819,7 @@
 
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
-		InvalidateWindow(WC_COMPANY, v->owner);
+		SetWindowDirty(WC_COMPANY, v->owner);
 		if (IsLocalCompany())
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window
 
@@ -948,8 +948,8 @@
 		v->cargo_subtype = new_subtype;
 		v->colourmap = PAL_NONE; // invalidate vehicle colour map
 		v->InvalidateNewGRFCacheOfChain();
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
 	}
 
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -176,7 +176,7 @@
 		if (data == 0) { // New or deleted sign.
 			this->signs.ForceRebuild();
 			this->BuildSignsList();
-			this->InvalidateWidget(SLW_CAPTION);
+			this->SetWidgetDirty(SLW_CAPTION);
 			this->vscroll.SetCount(this->signs.Length());
 		} else { // Change of sign contents.
 			this->signs.ForceResort();
@@ -272,7 +272,7 @@
 		this->cur_sign = si->index;
 		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_LENGTH_SIGN_NAME_PIXELS);
 
-		this->InvalidateWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
+		this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT);
 		this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
 	}
 
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -427,7 +427,7 @@
 	SetDParam(1, this->facilities);
 	this->sign.UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION);
 
-	InvalidateWindow(WC_STATION_VIEW, this->index);
+	SetWindowDirty(WC_STATION_VIEW, this->index);
 }
 
 /** Update the virtual coords needed to draw the station sign for all stations. */
@@ -621,7 +621,7 @@
 	}
 
 	/* redraw the station view since acceptance changed */
-	InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST);
+	SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST);
 }
 
 static void UpdateStationSignCoord(BaseStation *st)
@@ -1153,7 +1153,7 @@
 		st->RecomputeIndustriesNear();
 		InvalidateWindowData(WC_SELECT_STATION, 0, 0);
 		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
 	}
 
 	return cost;
@@ -1310,7 +1310,7 @@
 		/* if we deleted the whole station, delete the train facility. */
 		if (st->train_station.tile == INVALID_TILE) {
 			st->facilities &= ~FACIL_TRAIN;
-			InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
+			SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
 			st->UpdateVirtCoord();
 			DeleteStationIfEmpty(st);
 		}
@@ -1345,7 +1345,7 @@
 	for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) {
 		Station *st = *stp;
 
-		if (st->train_station.tile == INVALID_TILE) InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
+		if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
 		st->MarkTilesDirty(false);
 		st->RecomputeIndustriesNear();
 	}
@@ -1433,7 +1433,7 @@
 		st->speclist  = NULL;
 		st->cached_anim_triggers = 0;
 
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
 		st->UpdateVirtCoord();
 		DeleteStationIfEmpty(st);
 	}
@@ -1636,7 +1636,7 @@
 		st->RecomputeIndustriesNear();
 		InvalidateWindowData(WC_SELECT_STATION, 0, 0);
 		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
 	}
 	return cost;
 }
@@ -1701,7 +1701,7 @@
 			pred->next = cur_stop->next;
 		}
 
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
 		delete cur_stop;
 
 		/* Make sure no vehicle is going to the old roadstop */
@@ -2001,10 +2001,10 @@
 		st->RecomputeIndustriesNear();
 		InvalidateWindowData(WC_SELECT_STATION, 0, 0);
 		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
 
 		if (_settings_game.economy.station_noise_level) {
-			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
+			SetWindowDirty(WC_TOWN_VIEW, st->town->index);
 		}
 	}
 
@@ -2066,10 +2066,10 @@
 		st->airport_tile = INVALID_TILE;
 		st->facilities &= ~FACIL_AIRPORT;
 
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
 
 		if (_settings_game.economy.station_noise_level) {
-			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
+			SetWindowDirty(WC_TOWN_VIEW, st->town->index);
 		}
 
 		st->UpdateVirtCoord();
@@ -2211,7 +2211,7 @@
 		st->RecomputeIndustriesNear();
 		InvalidateWindowData(WC_SELECT_STATION, 0, 0);
 		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
 	}
 
 	return CommandCost(EXPENSES_CONSTRUCTION, _price.build_dock);
@@ -2246,7 +2246,7 @@
 		st->dock_tile = INVALID_TILE;
 		st->facilities &= ~FACIL_DOCK;
 
-		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
+		SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
 		st->UpdateVirtCoord();
 		st->RecomputeIndustriesNear();
 		DeleteStationIfEmpty(st);
@@ -2823,9 +2823,9 @@
 
 	StationID index = st->index;
 	if (waiting_changed) {
-		InvalidateWindow(WC_STATION_VIEW, index); // update whole window
+		SetWindowDirty(WC_STATION_VIEW, index); // update whole window
 	} else {
-		InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list
+		SetWindowWidgetDirty(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list
 	}
 }
 
@@ -2891,7 +2891,7 @@
 
 	StationAnimationTrigger(st, st->xy, STAT_ANIM_NEW_CARGO, type);
 
-	InvalidateWindow(WC_STATION_VIEW, st->index);
+	SetWindowDirty(WC_STATION_VIEW, st->index);
 	st->MarkTilesDirty(true);
 }
 
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -254,7 +254,7 @@
 		this->last_station = NULL;
 
 		/* Set the modified widget dirty */
-		this->InvalidateWidget(SLW_LIST);
+		this->SetWidgetDirty(SLW_LIST);
 	}
 
 public:
@@ -969,7 +969,7 @@
 		for (CargoID c = 0; c < NUM_CARGO; c++) {
 			if (this->cargo_rows[c] == row) {
 				ToggleBit(this->cargo, c);
-				this->InvalidateWidget(SVW_WAITING);
+				this->SetWidgetDirty(SVW_WAITING);
 				break;
 			}
 		}
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -171,14 +171,14 @@
 
 		if (this->ticker_scroll < TICKER_STOP) { // Scrolling text
 			this->ticker_scroll += COUNTER_STEP;
-			this->InvalidateWidget(SBW_MIDDLE);
+			this->SetWidgetDirty(SBW_MIDDLE);
 		}
 
 		if (this->reminder_timeout > REMINDER_STOP) { // Red blot to show there are new unread newsmessages
 			this->reminder_timeout -= COUNTER_STEP;
 		} else if (this->reminder_timeout < REMINDER_STOP) {
 			this->reminder_timeout = REMINDER_STOP;
-			this->InvalidateWidget(SBW_MIDDLE);
+			this->SetWidgetDirty(SBW_MIDDLE);
 		}
 	}
 };
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -734,7 +734,7 @@
 			if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons
 			if (this->IsWidgetLowered(i)) {
 				this->RaiseWidget(i);
-				this->InvalidateWidget(i);
+				this->SetWidgetDirty(i);
 			}
 		}
 	}
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -40,7 +40,7 @@
 				v->current_order.wait_time = time;
 			}
 		}
-		InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index);
+		SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
 	}
 }
 
@@ -176,7 +176,7 @@
 			ClrBit(v2->vehicle_flags, VF_AUTOFILL_TIMETABLE);
 			ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
 		}
-		InvalidateWindow(WC_VEHICLE_TIMETABLE, v2->index);
+		SetWindowDirty(WC_VEHICLE_TIMETABLE, v2->index);
 	}
 
 	return CommandCost();
@@ -241,6 +241,6 @@
 	v->lateness_counter -= (timetabled - time_taken);
 
 	for (v = v->FirstShared(); v != NULL; v = v->NextShared()) {
-		InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index);
+		SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
 	}
 }
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -1120,12 +1120,12 @@
 	{
 		if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_mode) {
 			this->ToggleWidgetLoweredState(TBN_PAUSE);
-			this->InvalidateWidget(TBN_PAUSE);
+			this->SetWidgetDirty(TBN_PAUSE);
 		}
 
 		if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) {
 			this->ToggleWidgetLoweredState(TBN_FASTFORWARD);
-			this->InvalidateWidget(TBN_FASTFORWARD);
+			this->SetWidgetDirty(TBN_FASTFORWARD);
 		}
 	}
 
@@ -1143,7 +1143,7 @@
 		for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) {
 			if (this->IsWidgetLowered(i)) {
 				this->RaiseWidget(i);
-				this->InvalidateWidget(i);
+				this->SetWidgetDirty(i);
 			}
 		}
 	}
@@ -1393,8 +1393,8 @@
 	virtual void OnTimeout()
 	{
 		this->SetWidgetsLoweredState(false, TBSE_DATEBACKWARD, TBSE_DATEFORWARD, WIDGET_LIST_END);
-		this->InvalidateWidget(TBSE_DATEBACKWARD);
-		this->InvalidateWidget(TBSE_DATEFORWARD);
+		this->SetWidgetDirty(TBSE_DATEBACKWARD);
+		this->SetWidgetDirty(TBSE_DATEFORWARD);
 	}
 
 	virtual void OnTick()
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -339,7 +339,7 @@
 	this->sign.UpdatePosition(pt.x, pt.y - 24,
 		_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN);
 
-	InvalidateWindow(WC_TOWN_VIEW, this->index);
+	SetWindowDirty(WC_TOWN_VIEW, this->index);
 }
 
 /** Update the virtual coords needed to draw the town sign for all towns. */
@@ -360,7 +360,7 @@
 static void ChangePopulation(Town *t, int mod)
 {
 	t->population += mod;
-	InvalidateWindow(WC_TOWN_VIEW, t->index);
+	SetWindowDirty(WC_TOWN_VIEW, t->index);
 	t->UpdateVirtCoord();
 
 	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
@@ -2471,7 +2471,7 @@
 		 */
 		if (t->ratings[_current_company] > RATING_BRIBE_DOWN_TO) {
 			t->ratings[_current_company] = RATING_BRIBE_DOWN_TO;
-			InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
+			SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
 		}
 	} else {
 		ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM, DC_EXEC);
@@ -2575,7 +2575,7 @@
 
 	if (flags & DC_EXEC) {
 		_town_action_proc[p2](t);
-		InvalidateWindow(WC_TOWN_AUTHORITY, p1);
+		SetWindowDirty(WC_TOWN_AUTHORITY, p1);
 	}
 
 	return cost;
@@ -2616,7 +2616,7 @@
 		t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM);
 	}
 
-	InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
+	SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
 
 	ClrBit(t->flags, TOWN_IS_FUNDED);
 	if (_settings_game.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
@@ -2675,7 +2675,7 @@
 	t->max_mail = t->new_max_mail; t->new_max_mail = 0;
 	t->act_mail = t->new_act_mail; t->new_act_mail = 0;
 
-	InvalidateWindow(WC_TOWN_VIEW, t->index);
+	SetWindowDirty(WC_TOWN_VIEW, t->index);
 }
 
 static void UpdateTownUnwanted(Town *t)
@@ -2821,7 +2821,7 @@
 	} else {
 		SetBit(t->have_ratings, _current_company);
 		t->ratings[_current_company] = rating;
-		InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
+		SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
 	}
 }
 
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -130,8 +130,8 @@
 
 		v->tcache.cached_power = total_power;
 		v->tcache.cached_max_te = max_te;
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 }
 
@@ -355,7 +355,7 @@
 
 	if (v->IsFrontEngine()) {
 		UpdateTrainAcceleration(v);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 	}
 }
 
@@ -768,7 +768,7 @@
 		TrainConsistChanged(v->First(), false);
 		UpdateTrainGroupID(v->First());
 
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 		if (IsLocalCompany()) {
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window
 		}
@@ -939,7 +939,7 @@
 
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
-		InvalidateWindow(WC_COMPANY, v->owner);
+		SetWindowDirty(WC_COMPANY, v->owner);
 		if (IsLocalCompany()) {
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window
 		}
@@ -1406,11 +1406,11 @@
 			UpdateTrainGroupID(src_head);
 			if (src_head->IsFrontEngine()) {
 				/* Update the refit button and window */
-				InvalidateWindow(WC_VEHICLE_REFIT, src_head->index);
-				InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH);
+				SetWindowDirty(WC_VEHICLE_REFIT, src_head->index);
+				SetWindowWidgetDirty(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH);
 			}
 			/* Update the depot window */
-			InvalidateWindow(WC_VEHICLE_DEPOT, src_head->tile);
+			SetWindowDirty(WC_VEHICLE_DEPOT, src_head->tile);
 		}
 
 		if (dst_head != NULL) {
@@ -1419,11 +1419,11 @@
 			UpdateTrainGroupID(dst_head);
 			if (dst_head->IsFrontEngine()) {
 				/* Update the refit button and window */
-				InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH);
-				InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index);
+				SetWindowWidgetDirty(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH);
+				SetWindowDirty(WC_VEHICLE_REFIT, dst_head->index);
 			}
 			/* Update the depot window */
-			InvalidateWindow(WC_VEHICLE_DEPOT, dst_head->tile);
+			SetWindowDirty(WC_VEHICLE_DEPOT, dst_head->tile);
 		}
 
 		InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
@@ -1470,7 +1470,7 @@
 			DeleteWindowById(WC_VEHICLE_DETAILS, first->index);
 			DeleteWindowById(WC_VEHICLE_TIMETABLE, first->index);
 		}
-		InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
+		SetWindowDirty(WC_VEHICLE_DEPOT, first->tile);
 		InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
 	}
 
@@ -1546,7 +1546,7 @@
 					NormaliseTrainConsist(first);
 					TrainConsistChanged(first, false);
 					UpdateTrainGroupID(first);
-					if (first->IsFrontEngine()) InvalidateWindow(WC_VEHICLE_REFIT, first->index);
+					if (first->IsFrontEngine()) SetWindowDirty(WC_VEHICLE_REFIT, first->index);
 				}
 
 			}
@@ -1597,7 +1597,7 @@
 				NormaliseTrainConsist(first);
 				TrainConsistChanged(first, false);
 				UpdateTrainGroupID(first);
-				InvalidateWindow(WC_VEHICLE_REFIT, first->index);
+				SetWindowDirty(WC_VEHICLE_REFIT, first->index);
 			}
 		} break;
 	}
@@ -1633,7 +1633,7 @@
 	if (spd != old) {
 		v->tcache.last_speed = spd;
 		if (_settings_client.gui.vehicle_speed || (old == 0) != (spd == 0)) {
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 	}
 }
@@ -1655,7 +1655,7 @@
 		v->subspeed = 0;
 		SetLastSpeed(v, 0);
 
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 }
 
@@ -1960,7 +1960,7 @@
 	/* If we are inside a depot after reversing, don't bother with path reserving. */
 	if (v->track == TRACK_BIT_DEPOT) {
 		/* Can't be stuck here as inside a depot is always a safe tile. */
-		if (HasBit(v->flags, VRF_TRAIN_STUCK)) InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		if (HasBit(v->flags, VRF_TRAIN_STUCK)) SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		ClrBit(v->flags, VRF_TRAIN_STUCK);
 		return;
 	}
@@ -2018,8 +2018,8 @@
 
 		if (flags & DC_EXEC) {
 			ToggleBit(v->flags, VRF_REVERSE_DIRECTION);
-			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
-			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+			SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
+			SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 		}
 	} else {
 		/* turn the whole train around */
@@ -2148,8 +2148,8 @@
 				v->cargo_type = new_cid;
 				v->cargo_cap = amount;
 				v->cargo_subtype = new_subtype;
-				InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-				InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+				SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
+				SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 				InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
 			}
 		}
@@ -2437,7 +2437,7 @@
 	/* if the train got no power, then keep it in the depot */
 	if (v->tcache.cached_power == 0) {
 		v->vehstatus |= VS_STOPPED;
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 		return true;
 	}
 
@@ -2446,7 +2446,7 @@
 	if (v->force_proceed == 0) {
 		/* force proceed was not pressed */
 		if (++v->load_unload_time_rem < 37) {
-			InvalidateWindowClasses(WC_TRAINS_LIST);
+			SetWindowClassesDirty(WC_TRAINS_LIST);
 			return true;
 		}
 
@@ -2455,7 +2455,7 @@
 		seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
 		if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) {
 			/* Full and no PBS signal in block or depot reserved, can't exit. */
-			InvalidateWindowClasses(WC_TRAINS_LIST);
+			SetWindowClassesDirty(WC_TRAINS_LIST);
 			return true;
 		}
 	} else {
@@ -2474,7 +2474,7 @@
 	/* Only leave when we can reserve a path to our destination. */
 	if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->force_proceed == 0) {
 		/* No path and no force proceed. */
-		InvalidateWindowClasses(WC_TRAINS_LIST);
+		SetWindowClassesDirty(WC_TRAINS_LIST);
 		MarkTrainAsStuck(v);
 		return true;
 	}
@@ -2483,7 +2483,7 @@
 	if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile);
 
 	VehicleServiceInDepot(v);
-	InvalidateWindowClasses(WC_TRAINS_LIST);
+	SetWindowClassesDirty(WC_TRAINS_LIST);
 	v->PlayLeaveStationSound();
 
 	v->track = TRACK_BIT_X;
@@ -3169,7 +3169,7 @@
 	/* If we have a reserved path and the path ends at a safe tile, we are finished already. */
 	if (origin.okay && (v->tile != origin.tile || first_tile_okay)) {
 		/* Can't be stuck then. */
-		if (HasBit(v->flags, VRF_TRAIN_STUCK)) InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		if (HasBit(v->flags, VRF_TRAIN_STUCK)) SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		ClrBit(v->flags, VRF_TRAIN_STUCK);
 		return true;
 	}
@@ -3197,7 +3197,7 @@
 
 	if (HasBit(v->flags, VRF_TRAIN_STUCK)) {
 		v->load_unload_time_rem = 0;
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 	ClrBit(v->flags, VRF_TRAIN_STUCK);
 	return true;
@@ -3536,11 +3536,11 @@
 
 	v->crash_anim_pos++;
 
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
-	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 	if (v->track == TRACK_BIT_DEPOT) {
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 	}
 
 	InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
@@ -4024,7 +4024,7 @@
 		/* Update the depot window if the first vehicle is in depot -
 		 * if v == first, then it is updated in PreDestructor() */
 		if (first->track == TRACK_BIT_DEPOT) {
-			InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
+			SetWindowDirty(WC_VEHICLE_DEPOT, first->tile);
 		}
 	}
 
@@ -4121,7 +4121,7 @@
 	if (state >= 4440 && !(v->tick_counter & 0x1F)) {
 		bool ret = v->Next() != NULL;
 		DeleteLastWagon(v);
-		InvalidateWindow(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN);
+		SetWindowDirty(WC_REPLACE_VEHICLE, (v->group_id << 16) | VEH_TRAIN);
 		return ret;
 	}
 
@@ -4137,8 +4137,8 @@
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
 
-		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
 			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
@@ -4154,7 +4154,7 @@
 	if (!(v->tick_counter & 3)) {
 		if (!--v->breakdown_delay) {
 			v->breakdown_ctr = 0;
-			InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+			SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 		}
 	}
 }
@@ -4330,7 +4330,7 @@
 	if (v->force_proceed != 0) {
 		v->force_proceed--;
 		ClrBit(v->flags, VRF_TRAIN_STUCK);
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	/* train is broken down? */
@@ -4399,13 +4399,13 @@
 			if (v->force_proceed == 0) return true;
 			ClrBit(v->flags, VRF_TRAIN_STUCK);
 			v->load_unload_time_rem = 0;
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 	}
 
 	if (v->current_order.IsType(OT_LEAVESTATION)) {
 		v->current_order.Free();
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		return true;
 	}
 
@@ -4413,7 +4413,7 @@
 
 	/* we need to invalidate the widget if we are stopping from 'Stopping 0 km/h' to 'Stopped' */
 	if (v->cur_speed == 0 && v->tcache.last_speed == 0 && (v->vehstatus & VS_STOPPED)) {
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	int adv_spd = (v->direction & 1) ? 192 : 256;
@@ -4521,7 +4521,7 @@
 			 * suddenly moved farther away, we continue our normal
 			 * schedule? */
 			v->current_order.MakeDummy();
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 		return;
 	}
@@ -4536,7 +4536,7 @@
 
 	v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
 	v->dest_tile = tfdd.tile;
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 }
 
 void Train::OnNewDay()
@@ -4566,8 +4566,8 @@
 
 			SubtractMoneyFromCompanyFract(this->owner, cost);
 
-			InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
-			InvalidateWindowClasses(WC_TRAINS_LIST);
+			SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
+			SetWindowClassesDirty(WC_TRAINS_LIST);
 		}
 	} else if (this->IsEngine()) {
 		/* Also age engines that aren't front engines */
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -117,7 +117,7 @@
 			if (IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN))) {
 				MarkWholeScreenDirty();
 			} else {
-				this->InvalidateWidget(TTW_WIDGET_BUTTONS);
+				this->SetWidgetDirty(TTW_WIDGET_BUTTONS);
 			}
 		}
 	}
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -152,7 +152,7 @@
 	virtual void OnTimeout()
 	{
 		this->RaiseWidget(BTW_MANY_RANDOM);
-		this->InvalidateWidget(BTW_MANY_RANDOM);
+		this->SetWidgetDirty(BTW_MANY_RANDOM);
 	}
 
 	virtual void OnPlaceObjectAbort()
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -69,7 +69,7 @@
 		DoClearSquare(t + TileDiffXY(1, 0));
 		DoClearSquare(t + TileDiffXY(1, 1));
 		c->location_of_HQ = INVALID_TILE; // reset HQ position
-		InvalidateWindow(WC_COMPANY, cid);
+		SetWindowDirty(WC_COMPANY, cid);
 
 		CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, cid);
 	}
@@ -127,7 +127,7 @@
 		MakeCompanyHQ(tile, _current_company);
 
 		UpdateCompanyHQ(c, score);
-		InvalidateWindow(WC_COMPANY, c->index);
+		SetWindowDirty(WC_COMPANY, c->index);
 	}
 
 	return cost;
@@ -291,7 +291,7 @@
 
 		TownID town = GetStatueTownID(tile);
 		ClrBit(Town::Get(town)->statues, GetTileOwner(tile));
-		InvalidateWindow(WC_TOWN_AUTHORITY, town);
+		SetWindowDirty(WC_TOWN_AUTHORITY, town);
 	}
 
 	if (flags & DC_EXEC) {
@@ -486,7 +486,7 @@
 			DoClearSquare(tile);
 		}
 
-		InvalidateWindow(WC_TOWN_AUTHORITY, town);
+		SetWindowDirty(WC_TOWN_AUTHORITY, town);
 	} else {
 		DoClearSquare(tile);
 	}
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -87,7 +87,7 @@
 	v->date_of_last_service = _date;
 	v->breakdowns_since_last_service = 0;
 	v->reliability = Engine::Get(v->engine_type)->reliability;
-	InvalidateWindow(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated
+	SetWindowDirty(WC_VEHICLE_DETAILS, v->index); // ensure that last service date and reliability are updated
 }
 
 bool Vehicle::NeedsServicing() const
@@ -517,7 +517,7 @@
 		DeleteWindowById(WC_VEHICLE_REFIT, this->index);
 		DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
 		DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
-		InvalidateWindow(WC_COMPANY, this->owner);
+		SetWindowDirty(WC_COMPANY, this->owner);
 	}
 	InvalidateWindowClassesData(GetWindowClassForVehicleType(this->type), 0);
 
@@ -824,7 +824,7 @@
 void DecreaseVehicleValue(Vehicle *v)
 {
 	v->value -= v->value >> 8;
-	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+	SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 }
 
 static const byte _breakdown_chance[64] = {
@@ -844,7 +844,7 @@
 
 	/* decrease reliability */
 	v->reliability = rel = max((rel_old = v->reliability) - v->reliability_spd_dec, 0);
-	if ((rel_old >> 8) != (rel >> 8)) InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+	if ((rel_old >> 8) != (rel >> 8)) SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 	if (v->breakdown_ctr != 0 || (v->vehstatus & VS_STOPPED) ||
 			_settings_game.difficulty.vehicle_breakdowns < 1 ||
@@ -884,7 +884,7 @@
 		v->reliability_spd_dec <<= 1;
 	}
 
-	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+	SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
 	/* Don't warn about non-primary or not ours vehicles or vehicles that are crashed */
 	if (v->Previous() != NULL || v->owner != _local_company || (v->vehstatus & VS_CRASHED) != 0) return;
@@ -960,7 +960,7 @@
 	switch (v->type) {
 		case VEH_TRAIN: {
 			Train *t = Train::From(v);
-			InvalidateWindowClasses(WC_TRAINS_LIST);
+			SetWindowClassesDirty(WC_TRAINS_LIST);
 			/* Clear path reservation */
 			SetDepotReservation(t->tile, false);
 			if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile);
@@ -973,17 +973,17 @@
 		}
 
 		case VEH_ROAD:
-			InvalidateWindowClasses(WC_ROADVEH_LIST);
+			SetWindowClassesDirty(WC_ROADVEH_LIST);
 			break;
 
 		case VEH_SHIP:
-			InvalidateWindowClasses(WC_SHIPS_LIST);
+			SetWindowClassesDirty(WC_SHIPS_LIST);
 			Ship::From(v)->state = TRACK_BIT_DEPOT;
 			RecalcShipStuff(v);
 			break;
 
 		case VEH_AIRCRAFT:
-			InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+			SetWindowClassesDirty(WC_AIRCRAFT_LIST);
 			HandleAircraftEnterHangar(Aircraft::From(v));
 			break;
 		default: NOT_REACHED();
@@ -994,7 +994,7 @@
 		 * We only increase the number of vehicles when the first one enters, so we will not need to search for more vehicles in the depot */
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 	}
-	InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+	SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 
 	v->vehstatus |= VS_HIDDEN;
 	v->cur_speed = 0;
@@ -1004,7 +1004,7 @@
 	TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
 
 	if (v->current_order.IsType(OT_GOTO_DEPOT)) {
-		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 
 		const Order *real_order = v->GetOrder(v->cur_order_index);
 		Order t = v->current_order;
@@ -1435,10 +1435,10 @@
 
 	PrepareUnload(this);
 
-	InvalidateWindow(GetWindowClassForVehicleType(this->type), this->owner);
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
-	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
-	InvalidateWindow(WC_STATION_VIEW, this->last_station_visited);
+	SetWindowDirty(GetWindowClassForVehicleType(this->type), this->owner);
+	SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
+	SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
+	SetWindowDirty(WC_STATION_VIEW, this->last_station_visited);
 
 	Station::Get(this->last_station_visited)->MarkTilesDirty(true);
 	this->cur_speed = 0;
@@ -1517,7 +1517,7 @@
 			if (flags & DC_EXEC) {
 				this->current_order.SetDepotOrderType(ODTF_MANUAL);
 				this->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
-				InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
+				SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
 			}
 			return CommandCost();
 		}
@@ -1529,7 +1529,7 @@
 			if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->IncrementOrderIndex();
 
 			this->current_order.MakeDummy();
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
+			SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
 		}
 		return CommandCost();
 	}
@@ -1546,7 +1546,7 @@
 		this->dest_tile = location;
 		this->current_order.MakeGoToDepot(destination, ODTF_MANUAL);
 		if (!(command & DEPOT_SERVICE)) this->current_order.SetDepotActionType(ODATFB_HALT);
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
 
 		/* If there is no depot in front, reverse automatically (trains only) */
 		if (this->type == VEH_TRAIN && reverse) DoCommand(this->tile, this->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
@@ -1645,8 +1645,8 @@
 		/* Code ripped from CmdStartStopTrain. Can't call it, because of
 		 * ownership problems, so we'll duplicate some code, for now */
 		v->vehstatus |= VS_STOPPED;
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 	}
 }
 
@@ -1672,7 +1672,7 @@
 
 			v->profit_last_year = v->profit_this_year;
 			v->profit_this_year = 0;
-			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+			SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 		}
 	}
 }
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -106,9 +106,9 @@
 
 		v->vehstatus ^= VS_STOPPED;
 		if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly'
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
-		InvalidateWindowClasses(GetWindowClassForVehicleType(v->type));
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowClassesDirty(GetWindowClassForVehicleType(v->type));
 	}
 	return CommandCost();
 }
@@ -567,7 +567,7 @@
 
 	if (flags & DC_EXEC) {
 		v->service_interval = serv_int;
-		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 	}
 
 	return CommandCost();
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -462,10 +462,10 @@
 void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out)
 {
 	w->SetWidgetDisabledState(widget_zoom_in, vp->zoom == ZOOM_LVL_MIN);
-	w->InvalidateWidget(widget_zoom_in);
+	w->SetWidgetDirty(widget_zoom_in);
 
 	w->SetWidgetDisabledState(widget_zoom_out, vp->zoom == ZOOM_LVL_MAX);
-	w->InvalidateWidget(widget_zoom_out);
+	w->SetWidgetDirty(widget_zoom_out);
 }
 
 /**
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -837,8 +837,8 @@
 			return;
 		}
 
-		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
-		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+		SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 
 		AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED));
 		SetDParam(0, pass);
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -991,7 +991,7 @@
  * Mark the widget as 'dirty' (in need of repaint).
  * @param w Window owning the widget.
  */
-void NWidgetBase::Invalidate(const Window *w) const
+void NWidgetBase::SetDirty(const Window *w) const
 {
 	int abs_left = w->left + this->pos_x;
 	int abs_top = w->top + this->pos_y;
@@ -1654,7 +1654,7 @@
 	/* Spacer widget is never visible. */
 }
 
-void NWidgetSpacer::Invalidate(const Window *w) const
+void NWidgetSpacer::SetDirty(const Window *w) const
 {
 	/* Spacer widget never need repainting. */
 }
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -209,7 +209,7 @@
 	inline uint GetVerticalStepSize(SizingType sizing) const;
 
 	virtual void Draw(const Window *w) = 0;
-	virtual void Invalidate(const Window *w) const;
+	virtual void SetDirty(const Window *w) const;
 
 	WidgetType type;      ///< Type of the widget / nested widget.
 	bool fill_x;          ///< Allow horizontal filling from initial size.
@@ -458,7 +458,7 @@
 	/* virtual */ void FillNestedArray(NWidgetCore **array, uint length);
 
 	/* virtual */ void Draw(const Window *w);
-	/* virtual */ void Invalidate(const Window *w) const;
+	/* virtual */ void SetDirty(const Window *w) const;
 	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 };
 
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -104,7 +104,7 @@
 		Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num);
 		if (w2 != NULL) {
 			w2->RaiseWidget(this->parent_button);
-			w2->InvalidateWidget(this->parent_button);
+			w2->SetWidgetDirty(this->parent_button);
 		}
 
 		DeleteDropDownList(this->list);
@@ -252,7 +252,7 @@
 	DeleteWindowById(WC_DROPDOWN_MENU, 0);
 
 	w->LowerWidget(button);
-	w->InvalidateWidget(button);
+	w->SetWidgetDirty(button);
 
 	/* Our parent's button widget is used to determine where to place the drop
 	 * down list window. */
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -107,9 +107,9 @@
 	if (_focused_window != NULL) {
 		if (_focused_window->focused_widget != NULL) {
 			uint focused_widget_id = _focused_window->focused_widget - _focused_window->widget;
-			_focused_window->InvalidateWidget(focused_widget_id);
+			_focused_window->SetWidgetDirty(focused_widget_id);
 		}
-		if (_focused_window->nested_focus != NULL) _focused_window->nested_focus->Invalidate(_focused_window);
+		if (_focused_window->nested_focus != NULL) _focused_window->nested_focus->SetDirty(_focused_window);
 	}
 
 	/* Remember which window was previously focused */
@@ -152,7 +152,7 @@
 
 		if (this->focused_widget != NULL) {
 			/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
-			this->InvalidateWidget(this->focused_widget - this->widget);
+			this->SetWidgetDirty(this->focused_widget - this->widget);
 		}
 		this->focused_widget = &this->widget[widget_index];
 		return true;
@@ -167,7 +167,7 @@
 			if (this->nested_array[widget_index] == this->nested_focus) return false;
 
 			/* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
-			this->nested_focus->Invalidate(this);
+			this->nested_focus->SetDirty(this);
 		}
 		this->nested_focus = this->nested_array[widget_index];
 		return true;
@@ -246,7 +246,7 @@
 		for (uint i = 0; i < this->widget_count; i++) {
 			if ((!autoraise || (this->widget[i].type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) {
 				this->RaiseWidget(i);
-				this->InvalidateWidget(i);
+				this->SetWidgetDirty(i);
 			}
 		}
 	}
@@ -254,7 +254,7 @@
 		for (uint i = 0; i < this->nested_array_size; i++) {
 			if (this->nested_array[i] != NULL && (!autoraise || (this->nested_array[i]->type & WWB_PUSHBUTTON)) && this->IsWidgetLowered(i)) {
 				this->RaiseWidget(i);
-				this->InvalidateWidget(i);
+				this->SetWidgetDirty(i);
 			}
 		}
 	}
@@ -264,7 +264,7 @@
  * Invalidate a widget, i.e. mark it as being changed and in need of redraw.
  * @param widget_index the widget to redraw.
  */
-void Window::InvalidateWidget(byte widget_index) const
+void Window::SetWidgetDirty(byte widget_index) const
 {
 	if (this->widget != NULL) {
 		const Widget *wi = &this->widget[widget_index];
@@ -274,7 +274,7 @@
 
 		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 @@
 {
 	this->LowerWidget(widget);
 	this->flags4 |= WF_TIMEOUT_BEGIN;
-	this->InvalidateWidget(widget);
+	this->SetWidgetDirty(widget);
 }
 
 /**
@@ -409,13 +409,13 @@
 			 * we assume that that button is used to resize to the left. */
 			int left_pos = (wi != NULL) ? wi->left : nw->pos_x;
 			StartWindowSizing(w, left_pos < (w->width / 2));
-			w->InvalidateWidget(widget_index);
+			w->SetWidgetDirty(widget_index);
 			return;
 		}
 
 		if ((w->desc_flags & WDF_STICKY_BUTTON) && widget_type == WWT_STICKYBOX) {
 			w->flags4 ^= WF_STICKY;
-			w->InvalidateWidget(widget_index);
+			w->SetWidgetDirty(widget_index);
 			return;
 		}
 	}
@@ -2440,7 +2440,7 @@
  * @param cls Window class
  * @param number Window number in that class
  */
-void InvalidateWindow(WindowClass cls, WindowNumber number)
+void SetWindowDirty(WindowClass cls, WindowNumber number)
 {
 	const Window *w;
 	FOR_ALL_WINDOWS_FROM_BACK(w) {
@@ -2454,12 +2454,12 @@
  * @param number Window number in that class
  * @param widget_index Index number of the widget that needs repainting
  */
-void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
+void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index)
 {
 	const Window *w;
 	FOR_ALL_WINDOWS_FROM_BACK(w) {
 		if (w->window_class == cls && w->window_number == number) {
-			w->InvalidateWidget(widget_index);
+			w->SetWidgetDirty(widget_index);
 		}
 	}
 }
@@ -2468,7 +2468,7 @@
  * Mark all windows of a particular class as dirty (in need of repainting)
  * @param cls Window class
  */
-void InvalidateWindowClasses(WindowClass cls)
+void SetWindowClassesDirty(WindowClass cls)
 {
 	Window *w;
 	FOR_ALL_WINDOWS_FROM_BACK(w) {
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -39,9 +39,9 @@
 
 void ReInitAllWindows();
 
-void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
-void InvalidateWindow(WindowClass cls, WindowNumber number);
-void InvalidateWindowClasses(WindowClass cls);
+void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index);
+void SetWindowDirty(WindowClass cls, WindowNumber number);
+void SetWindowClassesDirty(WindowClass cls);
 
 void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true);
 void DeleteWindowByClass(WindowClass cls);
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -619,7 +619,7 @@
 	void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
 	void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...);
 	void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
-	void InvalidateWidget(byte widget_index) const;
+	void SetWidgetDirty(byte widget_index) const;
 
 	void DrawWidgets() const;
 	void DrawViewport() const;