diff options
author | glx22 <glx@openttd.org> | 2021-04-28 21:24:24 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-04-29 21:08:24 +0200 |
commit | 14e92bd8e241998ced263ee542965a71bbdd77a5 (patch) | |
tree | 08490feac7c2c15c97daee67dc3c1329fc703a95 /src/viewport.cpp | |
parent | a61696d6c565ff92c6604b12eefe36198d094056 (diff) | |
download | openttd-14e92bd8e241998ced263ee542965a71bbdd77a5.tar.xz |
Codechange: Replace window related FOR_ALL with range-based for loops
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index aae659d53..303e02760 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -268,7 +268,7 @@ static Point _vp_move_offs; static void DoSetViewportPosition(const Window *w, int left, int top, int width, int height) { - FOR_ALL_WINDOWS_FROM_BACK_FROM(w, w) { + for (const Window *w : Window::IterateFromBack(w)) { if (left + width > w->left && w->left + w->width > left && top + height > w->top && @@ -1475,8 +1475,7 @@ void ViewportSign::MarkDirty(ZoomLevel maxzoom) const zoomlevels[zoom].bottom = this->top + ScaleByZoom(VPSM_TOP + FONT_HEIGHT_NORMAL + VPSM_BOTTOM + 1, zoom); } - Window *w; - FOR_ALL_WINDOWS_FROM_BACK(w) { + for (const Window *w : Window::IterateFromBack()) { Viewport *vp = w->viewport; if (vp != nullptr && vp->zoom <= maxzoom) { assert(vp->width != 0); @@ -1949,8 +1948,7 @@ bool MarkAllViewportsDirty(int left, int top, int right, int bottom) { bool dirty = false; - Window *w; - FOR_ALL_WINDOWS_FROM_BACK(w) { + for (const Window *w : Window::IterateFromBack()) { Viewport *vp = w->viewport; if (vp != nullptr) { assert(vp->width != 0); @@ -1963,8 +1961,7 @@ bool MarkAllViewportsDirty(int left, int top, int right, int bottom) void ConstrainAllViewportsZoom() { - Window *w; - FOR_ALL_WINDOWS_FROM_FRONT(w) { + for (Window *w : Window::IterateFromFront()) { if (w->viewport == nullptr) continue; ZoomLevel zoom = static_cast<ZoomLevel>(Clamp(w->viewport->zoom, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max)); |