Codechange: Replace window related FOR_ALL with range-based for loops

This commit is contained in:
glx22
2021-04-28 21:24:24 +02:00
committed by Loïc Guilloux
parent a61696d6c5
commit 14e92bd8e2
6 changed files with 113 additions and 106 deletions

View File

@@ -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));