diff options
author | rubidium <rubidium@openttd.org> | 2009-02-04 16:59:41 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-04 16:59:41 +0000 |
commit | 42fe0b65d2826aeef9866cbdccccb38884616ba2 (patch) | |
tree | 0b2799a662a70856b0fe38c29efcafe45c25f8e4 /src/window.cpp | |
parent | cd9c35b84e6d3eea538368071acb3301484071e8 (diff) | |
download | openttd-42fe0b65d2826aeef9866cbdccccb38884616ba2.tar.xz |
(svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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() { |