diff options
author | frosch <frosch@openttd.org> | 2021-05-09 16:42:36 +0200 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2021-05-12 23:22:41 +0200 |
commit | 22567a1f43d29a7596b9ef88441d5a65776fa2c8 (patch) | |
tree | d20fd1334d03c74a65a3778638da39c34c49c340 /src/window.cpp | |
parent | aba239479b6e75990cc914331bd2d735b8918628 (diff) | |
download | openttd-22567a1f43d29a7596b9ef88441d5a65776fa2c8.tar.xz |
Codechange: use iterators instead of 'subranges' when iterating from a specific window.
Using iterators makes it easier to include or exclude the start window in the iteration.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp index d6901bd97..9b51eafd8 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -896,7 +896,10 @@ static bool MayBeShown(const Window *w) */ static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom) { - for (const Window *v : Window::IterateFromBack(w->z_front)) { + Window::IteratorToFront it(w); + ++it; + for (; !it.IsEnd(); ++it) { + const Window *v = *it; if (MayBeShown(v) && right > v->left && bottom > v->top && @@ -2530,7 +2533,10 @@ static bool MaybeBringWindowToFront(Window *w) w_height = w->unshaded_size.height; } - for (Window *u : Window::IterateFromBack(w->z_front)) { + Window::IteratorToFront it(w); + ++it; + for (; !it.IsEnd(); ++it) { + Window *u = *it; /* A modal child will prevent the activation of the parent window */ if (u->parent == w && (u->window_desc->flags & WDF_MODAL)) { u->SetWhiteBorder(); |