From 42fe0b65d2826aeef9866cbdccccb38884616ba2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 4 Feb 2009 16:59:41 +0000 Subject: (svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company. --- src/window.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index f5fed776d..5161bea4f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2191,6 +2191,28 @@ restart_search: } } +/** + * Delete all windows that are used for construction of vehicle etc. + * Once done with that invalidate the others to ensure they get refreshed too. + */ +void DeleteConstructionWindows() +{ + Window *w; + +restart_search: + /* When we find the window to delete, we need to restart the search + * as deleting this window could cascade in deleting (many) others + * anywhere in the z-array */ + FOR_ALL_WINDOWS_FROM_BACK(w) { + if (w->desc_flags & WDF_CONSTRUCTION) { + delete w; + goto restart_search; + } + } + + FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty(); +} + /** Delete all always on-top windows to get an empty screen */ void HideVitalWindows() { -- cgit v1.2.3-70-g09d2