Files
commandergenius/project/jni/application/openttd/0241-Add-a-function-for-deleting-windows-linked-to-main-t.patch

60 lines
1.6 KiB
Diff

From 33d0fb1efffe097449201b5adc001706ffd565e9 Mon Sep 17 00:00:00 2001
From: Juanjo <juanjo.ng.83@gmail.com>
Date: Sat, 19 Oct 2013 13:35:17 +0000
Subject: [PATCH 241/249] Add a function for deleting windows linked to main
toolbar.
---
src/window.cpp | 22 ++++++++++++++++++++++
src/window_func.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/src/window.cpp b/src/window.cpp
index 6d9c087..795c82e 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3346,6 +3346,28 @@ restart_search:
FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty();
}
+/**
+ * Delete all windows that are linked to the main toolbar.
+ * Once done with that, refresh other windows too.
+ */
+void DeleteToolbarLinkedWindows()
+{
+ 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->window_desc->default_pos == WDP_ALIGN_TOOLBAR) {
+ 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()
{
diff --git a/src/window_func.h b/src/window_func.h
index a0fff7c..335ab9e 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -42,6 +42,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope =
void DeleteNonVitalWindows();
void DeleteAllNonVitalWindows();
void DeleteConstructionWindows();
+void DeleteToolbarLinkedWindows();
void HideVitalWindows();
void ShowVitalWindows();
--
1.8.1.2