summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 3fcda7d42..d6901bd97 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1168,14 +1168,10 @@ void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
*/
void DeleteWindowByClass(WindowClass cls)
{
-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 */
+ /* Note: the container remains stable, even when deleting windows. */
for (Window *w : Window::IterateFromBack()) {
if (w->window_class == cls) {
delete w;
- goto restart_search;
}
}
}
@@ -1188,14 +1184,10 @@ restart_search:
*/
void DeleteCompanyWindows(CompanyID id)
{
-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 */
+ /* Note: the container remains stable, even when deleting windows. */
for (Window *w : Window::IterateFromBack()) {
if (w->owner == id) {
delete w;
- goto restart_search;
}
}
@@ -3325,10 +3317,7 @@ void CallWindowGameTickEvent()
*/
void DeleteNonVitalWindows()
{
-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 */
+ /* Note: the container remains stable, even when deleting windows. */
for (const Window *w : Window::IterateFromBack()) {
if (w->window_class != WC_MAIN_WINDOW &&
w->window_class != WC_SELECT_GAME &&
@@ -3338,7 +3327,6 @@ restart_search:
(w->flags & WF_STICKY) == 0) { // do not delete windows which are 'pinned'
delete w;
- goto restart_search;
}
}
}
@@ -3355,14 +3343,10 @@ void DeleteAllNonVitalWindows()
/* Delete every window except for stickied ones, then sticky ones as well */
DeleteNonVitalWindows();
-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 */
+ /* Note: the container remains stable, even when deleting windows. */
for (const Window *w : Window::IterateFromBack()) {
if (w->flags & WF_STICKY) {
delete w;
- goto restart_search;
}
}
}
@@ -3384,14 +3368,10 @@ void DeleteAllMessages()
*/
void DeleteConstructionWindows()
{
-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 */
+ /* Note: the container remains stable, even when deleting windows. */
for (const Window *w : Window::IterateFromBack()) {
if (w->window_desc->flags & WDF_CONSTRUCTION) {
delete w;
- goto restart_search;
}
}