(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
authorrubidium
Tue, 06 May 2008 21:28:30 +0000
changeset 9115 47ae980bace3
parent 9114 032218c1235b
child 9116 f2491d3c321b
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
src/airport_gui.cpp
src/bridge_gui.cpp
src/dock_gui.cpp
src/engine_gui.cpp
src/genworld_gui.cpp
src/misc_gui.cpp
src/network/network_gui.cpp
src/news_gui.cpp
src/osk_gui.cpp
src/player_gui.cpp
src/rail_gui.cpp
src/road_gui.cpp
src/settings_gui.cpp
src/signs_gui.cpp
src/toolbar_gui.cpp
src/train_cmd.cpp
src/vehicle_gui.cpp
src/widgets/dropdown.cpp
src/window.cpp
src/window_func.h
src/window_gui.h
--- a/src/airport_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/airport_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -236,7 +236,7 @@
 
 		case WE_MOUSELOOP: {
 			if (WP(w, def_d).close) {
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
--- a/src/bridge_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/bridge_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -42,7 +42,7 @@
 
 static void BuildBridge(Window *w, int i)
 {
-	DeleteWindow(w);
+	delete w;
 	DoCommandP(_bridgedata.end_tile, _bridgedata.start_tile,
 		_bridgedata.type | _bridgedata.indexes[i], CcBuildBridge,
 		CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
--- a/src/dock_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/dock_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -280,7 +280,7 @@
 
 	case WE_MOUSELOOP:
 		if (WP(w, def_d).close) {
-			DeleteWindow(w);
+			delete w;
 			return;
 		}
 
@@ -354,7 +354,7 @@
 	} break;
 
 	case WE_MOUSELOOP:
-		if (WP(w, def_d).close) DeleteWindow(w);
+		if (WP(w, def_d).close) delete w;
 		break;
 
 	case WE_DESTROY:
--- a/src/engine_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/engine_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -96,7 +96,7 @@
 				DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
 				/* Fallthrough */
 			case 3:
-				DeleteWindow(w);
+				delete w;
 				break;
 		}
 		break;
--- a/src/genworld_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/genworld_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -342,7 +342,7 @@
 
 		case WE_CLICK:
 			switch (e->we.click.widget) {
-				case 0: DeleteWindow(w); break;
+				case 0: delete w; break;
 
 				case GLAND_TEMPERATE:
 				case GLAND_ARCTIC:
--- a/src/misc_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/misc_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -558,11 +558,11 @@
 			break;
 
 		case WE_MOUSELOOP:
-			if (_right_button_down) DeleteWindow(w);
+			if (_right_button_down) delete w;
 			break;
 
 		case WE_4:
-			if (--_errmsg_duration == 0) DeleteWindow(w);
+			if (--_errmsg_duration == 0) delete w;
 			break;
 
 		case WE_DESTROY:
@@ -575,7 +575,7 @@
 			if (e->we.keypress.keycode == WKC_SPACE) {
 				/* Don't continue. */
 				e->we.keypress.cont = false;
-				DeleteWindow(w);
+				delete w;
 			}
 			break;
 	}
@@ -711,9 +711,9 @@
 			/* We can show tooltips while dragging tools. These are shown as long as
 			 * we are dragging the tool. Normal tooltips work with rmb */
 			if (WP(w, tooltips_d).paramcount == 0 ) {
-				if (!_right_button_down) DeleteWindow(w);
+				if (!_right_button_down) delete w;
 			} else {
-				if (!_left_button_down) DeleteWindow(w);
+				if (!_left_button_down) delete w;
 			}
 
 			break;
@@ -1171,7 +1171,7 @@
 					}
 					/* Fallthrough */
 				case QUERY_STR_WIDGET_CANCEL:
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			break;
@@ -1183,7 +1183,7 @@
 		case WE_KEYPRESS:
 			switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) {
 				case 1: goto press_ok; // Enter pressed, confirms change
-				case 2: DeleteWindow(w); break; // ESC pressed, closes window, abandons changes
+				case 2: delete w; break; // ESC pressed, closes window, abandons changes
 			}
 			break;
 
@@ -1296,7 +1296,7 @@
 					if (q->proc != NULL) q->proc(w->parent, true);
 					/* Fallthrough */
 				case QUERY_WIDGET_NO:
-					DeleteWindow(w);
+					delete w;
 					break;
 				}
 			break;
@@ -1310,7 +1310,7 @@
 					/* Fallthrough */
 				case WKC_ESC:
 					e->we.keypress.cont = false;
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			break;
@@ -1581,13 +1581,13 @@
 							ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
 							ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
 
-							DeleteWindow(w);
+							delete w;
 						} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
 							SetFiosType(file->type);
 							ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
 							ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
 
-							DeleteWindow(w);
+							delete w;
 							ShowHeightmapLoad();
 						} else {
 							/* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */
@@ -1620,7 +1620,7 @@
 
 		case WE_KEYPRESS:
 			if (e->we.keypress.keycode == WKC_ESC) {
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
--- a/src/network/network_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/network/network_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -869,7 +869,7 @@
 							ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
 							ttd_strlcpy(_file_to_saveload.title, nd->map->title, sizeof(_file_to_saveload.title));
 
-							DeleteWindow(w);
+							delete w;
 							SwitchMode(SM_START_SCENARIO);
 						}
 					}
@@ -879,7 +879,7 @@
 					_is_network_server = true;
 					/* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets
 					* copied all the elements of 'load game' and upon closing that, it segfaults */
-					DeleteWindow(w);
+					delete w;
 					ShowSaveLoadDialog(SLD_LOAD_GAME);
 					break;
 			}
@@ -1672,7 +1672,7 @@
 		case WE_CLICK:
 			if (e->we.click.widget == 2) { //Disconnect button
 				NetworkDisconnect();
-				DeleteWindow(w);
+				delete w;
 				SwitchMode(SM_MENU);
 				ShowNetworkGameWindow();
 			}
@@ -1891,7 +1891,7 @@
 				case 3: /* Send */
 					SendChat(WP(w, chatquerystr_d).text.buf, WP(w, chatquerystr_d).dtype, WP(w, chatquerystr_d).dest);
 				/* FALLTHROUGH */
-				case 0: /* Cancel */ DeleteWindow(w); break;
+				case 0: /* Cancel */ delete w; break;
 			}
 			break;
 
@@ -1908,7 +1908,7 @@
 					case 1: /* Return */
 						SendChat(WP(w, chatquerystr_d).text.buf, WP(w, chatquerystr_d).dtype, WP(w, chatquerystr_d).dest);
 					/* FALLTHROUGH */
-					case 2: /* Escape */ DeleteWindow(w); break;
+					case 2: /* Escape */ delete w; break;
 				}
 			}
 			break;
@@ -1987,7 +1987,7 @@
 
 				/* FALL THROUGH */
 				case NCPWW_CANCEL:
-					DeleteWindow(w);
+					delete w;
 					break;
 
 				case NCPWW_SAVE_AS_DEFAULT_PASSWORD:
@@ -2013,7 +2013,7 @@
 					break;
 
 				case 2: // Escape
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			break;
--- a/src/news_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/news_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -195,7 +195,7 @@
 			switch (e->we.click.widget) {
 				case 1: {
 					NewsItem *ni = WP(w, news_d).ni;
-					DeleteWindow(w);
+					delete w;
 					ni->duration = 0;
 					_forced_news = INVALID_NEWS;
 					break;
@@ -227,7 +227,7 @@
 			if (e->we.keypress.keycode == WKC_SPACE) {
 				/* Don't continue. */
 				e->we.keypress.cont = false;
-				DeleteWindow(w);
+				delete w;
 			}
 			break;
 
--- a/src/osk_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/osk_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -164,7 +164,7 @@
 							parent->HandleWindowEvent(&e);
 						}
 					}
-					DeleteWindow(w);
+					delete w;
 					break;
 
 				case OSK_WIDGET_CANCEL:
@@ -179,7 +179,7 @@
 						UpdateTextBufferSize(&qs->text);
 						MoveTextBufferPos(&qs->text, WKC_END);
 					}
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			/* make sure that the parent window's textbox also gets updated */
--- a/src/player_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/player_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -197,7 +197,7 @@
 					int oldleft = w->left; ///< current left position of the window before closing it
 					PlayerID player = (PlayerID)w->window_number;
 
-					DeleteWindow(w);
+					delete w;
 					/* Open up the (toggled size) Finance window at the same position as the previous */
 					DoShowPlayerFinances(player, !HasBit(mode, 0), stickied, oldtop, oldleft);
 				}
@@ -871,20 +871,20 @@
 					int oldleft = w->left;   ///< current top position of the window before closing it
 
 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
-					DeleteWindow(w);
+					delete w;
 					/* Open up the (toggled size) Face selection window at the same position as the previous */
 					DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced, oldtop, oldleft);
 				} break;
 
 				/* Cancel button */
 				case PFW_WIDGET_CANCEL:
-					DeleteWindow(w);
+					delete w;
 					break;
 
 				/* OK button */
 				case PFW_WIDGET_ACCEPT:
 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
-					DeleteWindow(w);
+					delete w;
 					break;
 
 				/* Load button */
@@ -1379,7 +1379,7 @@
 		case WE_CLICK:
 			switch (e->we.click.widget) {
 				case 3:
-					DeleteWindow(w);
+					delete w;
 					break;
 				case 4: {
 					DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
@@ -1464,7 +1464,7 @@
 		} break;
 
 		case WE_CLICK: /* Close the window (and show the highscore window) */
-			DeleteWindow(w);
+			delete w;
 			break;
 
 		case WE_DESTROY: /* Show the highscore window when this one is closed */
@@ -1505,7 +1505,7 @@
 		} break;
 
 		case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
-			DeleteWindow(w);
+			delete w;
 			break;
 
 		case WE_DESTROY: /* Get back all the hidden windows */
--- a/src/rail_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/rail_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -1128,7 +1128,7 @@
 
 	case WE_MOUSELOOP:
 		if (WP(w, def_d).close) {
-			DeleteWindow(w);
+			delete w;
 			return;
 		}
 		CheckRedrawStationCoverage(w);
@@ -1352,7 +1352,7 @@
 			break;
 
 		case WE_MOUSELOOP:
-			if (WP(w, def_d).close) DeleteWindow(w);
+			if (WP(w, def_d).close) delete w;
 			return;
 
 		case WE_DESTROY:
@@ -1443,7 +1443,7 @@
 		break;
 
 	case WE_MOUSELOOP:
-		if (WP(w, def_d).close) DeleteWindow(w);
+		if (WP(w, def_d).close) delete w;
 		return;
 
 	case WE_DESTROY:
@@ -1542,7 +1542,7 @@
 	}
 
 	case WE_MOUSELOOP:
-		if (WP(w, def_d).close) DeleteWindow(w);
+		if (WP(w, def_d).close) delete w;
 		break;
 
 	case WE_DESTROY:
--- a/src/road_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/road_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -767,7 +767,7 @@
 			break;
 
 		case WE_MOUSELOOP:
-			if (WP(w, def_d).close) DeleteWindow(w);
+			if (WP(w, def_d).close) delete w;
 			break;
 
 		case WE_DESTROY:
@@ -925,7 +925,7 @@
 
 		case WE_MOUSELOOP:
 			if (WP(w, def_d).close) {
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
--- a/src/settings_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/settings_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -642,7 +642,7 @@
 							DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
 					}
 					DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
-					DeleteWindow(w);
+					delete w;
 					/* If we are in the editor, we should reload the economy.
 					 * This way when you load a game, the max loan and interest rate
 					 * are loaded correctly. */
@@ -651,7 +651,7 @@
 				}
 
 				case GDW_CANCEL: // Cancel button - close window, abandon changes
-					DeleteWindow(w);
+					delete w;
 					break;
 			} break;
 
--- a/src/signs_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/signs_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -246,7 +246,7 @@
 					/* FALL THROUGH */
 
 				case QUERY_EDIT_SIGN_WIDGET_CANCEL:
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			break;
@@ -258,7 +258,7 @@
 					/* FALL THROUGH */
 
 				case 2: // ESC pressed, closes window, abandons changes
-					DeleteWindow(w);
+					delete w;
 					break;
 			}
 			break;
--- a/src/toolbar_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/toolbar_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -1142,7 +1142,7 @@
 			}
 
 			int action_id = WP(w, menu_d).action_id;
-			DeleteWindow(w);
+			delete w;
 
 			if (index >= 0) {
 				assert((uint)index <= lengthof(_menu_clicked_procs));
@@ -1347,7 +1347,7 @@
 					index = WP(w, menu_d).sel_index;
 			}
 
-			DeleteWindow(w);
+			delete w;
 
 			if (index >= 0) {
 				assert(index >= 0 && index < 30);
--- a/src/train_cmd.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/train_cmd.cpp	Tue May 06 21:28:30 2008 +0000
@@ -1347,8 +1347,7 @@
 
 	if (flags & DC_EXEC) {
 		if (v == first && IsFrontEngine(first)) {
-			w = FindWindowById(WC_VEHICLE_VIEW, first->index);
-			if (w != NULL) DeleteWindow(w);
+			delete FindWindowById(WC_VEHICLE_VIEW, first->index);
 		}
 		InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
 		RebuildVehicleLists();
--- a/src/vehicle_gui.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/vehicle_gui.cpp	Tue May 06 21:28:30 2008 +0000
@@ -398,9 +398,9 @@
 								case VEH_SHIP:     command = CMD_REFIT_SHIP         | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP);     break;
 								case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT     | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
 							}
-							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
+							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8, NULL, command)) delete w;
 						} else {
-							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
+							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) delete w;
 						}
 					}
 					break;
--- a/src/widgets/dropdown.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/widgets/dropdown.cpp	Tue May 06 21:28:30 2008 +0000
@@ -172,7 +172,7 @@
 		case WE_MOUSELOOP: {
 			Window *w2 = FindWindowById(WP(w, dropdown_d).parent_wnd_class, WP(w,dropdown_d).parent_wnd_num);
 			if (w2 == NULL) {
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
@@ -182,7 +182,7 @@
 				e.we.dropdown.button = WP(w, dropdown_d).parent_button;
 				e.we.dropdown.index  = WP(w, dropdown_d).selected_index;
 				w2->HandleWindowEvent(&e);
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
@@ -362,7 +362,7 @@
 
 		if (pw->window_class == WP(*wz, dropdown_d).parent_wnd_class &&
 				pw->window_number == WP(*wz, dropdown_d).parent_wnd_num) {
-			DeleteWindow(*wz);
+			delete *wz;
 			break;
 		}
 	}
--- a/src/window.cpp	Tue May 06 21:07:47 2008 +0000
+++ b/src/window.cpp	Tue May 06 21:28:30 2008 +0000
@@ -170,7 +170,7 @@
 
 		if (w->desc_flags & WDF_STD_BTN) {
 			if (e.we.click.widget == 0) { /* 'X' */
-				DeleteWindow(w);
+				delete w;
 				return;
 			}
 
@@ -369,10 +369,19 @@
  * @param w Window to redraw
  * @ingroup dirty
  */
+void Window::SetDirty() const
+{
+	SetDirtyBlocks(this->left, this->top, this->left + this->width, this->top + this->height);
+}
+
+/**
+ * Mark entire window as dirty (in need of re-paint)
+ * @param w Window to redraw
+ * @ingroup dirty
+ */
 void SetWindowDirty(const Window *w)
 {
-	if (w == NULL) return;
-	SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
+	if (w != NULL) w->SetDirty();
 }
 
 /** Find the Window whose parent pointer points to this window
@@ -410,44 +419,35 @@
 
 /**
  * Remove window and all its child windows from the window stack.
- * @param w Window to delete
  */
-void DeleteWindow(Window *w)
+Window::~Window()
 {
-	if (w == NULL) return;
-
 	if (_thd.place_mode != VHM_NONE &&
-			_thd.window_class == w->window_class &&
-			_thd.window_number == w->window_number) {
+			_thd.window_class == this->window_class &&
+			_thd.window_number == this->window_number) {
 		ResetObjectToPlace();
 	}
 
 	/* Prevent Mouseover() from resetting mouse-over coordinates on a non-existing window */
-	if (_mouseover_last_w == w) _mouseover_last_w = NULL;
+	if (_mouseover_last_w == this) _mouseover_last_w = NULL;
 
 	/* Find the window in the z-array, and effectively remove it
 	 * by moving all windows after it one to the left. This must be
 	 * done before removing the child so we cannot cause recursion
 	 * between the deletion of the parent and the child. */
-	Window **wz = FindWindowZPosition(w);
+	Window **wz = FindWindowZPosition(this);
 	if (wz == NULL) return;
 	memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
 	_last_z_window--;
 
 	/* Delete any children a window might have in a head-recursive manner */
-	Window *v = FindChildWindow(w);
-	if (v != NULL) DeleteWindow(v);
-
-	CallWindowEventNP(w, WE_DESTROY);
-	if (w->viewport != NULL) DeleteWindowViewport(w);
+	delete FindChildWindow(this);
 
-	SetWindowDirty(w);
-	free(w->widget);
-	w->widget = NULL;
-	w->widget_count = 0;
-	w->parent = NULL;
+	CallWindowEventNP(this, WE_DESTROY);
+	if (this->viewport != NULL) DeleteWindowViewport(this);
 
-	delete w;
+	this->SetDirty();
+	free(this->widget);
 }
 
 /**
@@ -475,7 +475,7 @@
  */
 void DeleteWindowById(WindowClass cls, WindowNumber number)
 {
-	DeleteWindow(FindWindowById(cls, number));
+	delete FindWindowById(cls, number);
 }
 
 /**
@@ -493,7 +493,7 @@
 	FOR_ALL_WINDOWS(wz) {
 		Window *w = *wz;
 		if (w->window_class == cls) {
-			DeleteWindow(w);
+			delete w;
 			goto restart_search;
 		}
 	}
@@ -514,7 +514,7 @@
 	FOR_ALL_WINDOWS(wz) {
 		Window *w = *wz;
 		if (w->caption_color == id) {
-			DeleteWindow(w);
+			delete w;
 			goto restart_search;
 		}
 	}
@@ -696,7 +696,7 @@
 	if (_last_z_window == endof(_z_windows)) {
 		w = FindDeletableWindow();
 		if (w == NULL) w = ForceFindDeletableWindow();
-		DeleteWindow(w);
+		delete w;
 	}
 
 	w = new Window(proc);
@@ -1087,7 +1087,7 @@
 	 * anywhere in the z-array. We call DeleteWindow() so that it can properly
 	 * release own alloc'd memory, which otherwise could result in memleaks */
 	FOR_ALL_WINDOWS(wz) {
-		DeleteWindow(*wz);
+		delete *wz;
 		goto restart_search;
 	}
 
@@ -2212,7 +2212,7 @@
 				w->window_class != WC_TOOLTIPS &&
 				(w->flags4 & WF_STICKY) == 0) { // do not delete windows which are 'pinned'
 
-			DeleteWindow(w);
+			delete w;
 			goto restart_search;
 		}
 	}
@@ -2236,7 +2236,7 @@
 	 * anywhere in the z-array */
 	FOR_ALL_WINDOWS(wz) {
 		if ((*wz)->flags4 & WF_STICKY) {
-			DeleteWindow(*wz);
+			delete *wz;
 			goto restart_search;
 		}
 	}
--- a/src/window_func.h	Tue May 06 21:07:47 2008 +0000
+++ b/src/window_func.h	Tue May 06 21:28:30 2008 +0000
@@ -13,7 +13,6 @@
 void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam);
 
 Window *FindWindowById(WindowClass cls, WindowNumber number);
-void DeleteWindow(Window *w);
 void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
 
 void ResizeWindow(Window *w, int x, int y);
--- a/src/window_gui.h	Tue May 06 21:07:47 2008 +0000
+++ b/src/window_gui.h	Tue May 06 21:28:30 2008 +0000
@@ -296,6 +296,7 @@
 
 public:
 	Window(WindowProc *proc) : wndproc(proc) {}
+	virtual ~Window();
 
 	uint16 flags4;              ///< Window flags, @see WindowFlags
 	WindowClass window_class;   ///< Window class
@@ -345,6 +346,8 @@
 	void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
 	void InvalidateWidget(byte widget_index) const;
 
+	void SetDirty() const;
+
 	virtual void HandleWindowEvent(WindowEvent *e);
 };
 
@@ -548,7 +551,6 @@
 void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam);
 
 Window *FindWindowById(WindowClass cls, WindowNumber number);
-void DeleteWindow(Window *w);
 void DeletePlayerWindows(PlayerID pi);
 void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
 Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);