summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-13 16:50:20 +0000
committerdarkvater <darkvater@openttd.org>2005-01-13 16:50:20 +0000
commit61cae70fe53653dab79ed90cb9418f6c88c2145a (patch)
tree75199ad8fbca21b3b52f2f5e212fe0ee70d9aa0e /window.c
parent06cc62f40d84c91bba41510bbeab0ba8df7106b9 (diff)
downloadopenttd-61cae70fe53653dab79ed90cb9418f6c88c2145a.tar.xz
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
-Added DeleteWindowByClass() function that deletes all windows of a given class
Diffstat (limited to 'window.c')
-rw-r--r--window.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/window.c b/window.c
index 86af083e0..96f5a1902 100644
--- a/window.c
+++ b/window.c
@@ -262,6 +262,18 @@ void DeleteWindowById(WindowClass cls, WindowNumber number)
DeleteWindow(FindWindowById(cls, number));
}
+void DeleteWindowByClass(WindowClass cls)
+{
+ Window *w;
+ for (w = _windows; w != _last_window;) {
+ if (w->window_class == cls) {
+ DeleteWindow(w);
+ w = _windows;
+ } else
+ w++;
+ }
+}
+
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
{
Window *w = FindWindowById(cls, number);