From d3cb6e1e6776279249ab8f1ceda843e5c551f9f7 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 1 Nov 2023 20:12:08 +0000 Subject: [PATCH] Codechange: Call Widget::SetDirty/SetLowered directly. (#11417) In these instances we already have the widget to hand, so don't need to look it up by index again. --- src/widgets/dropdown.cpp | 4 ++-- src/window.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index bca67a504e..5ee04219b5 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -438,9 +438,9 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, if ((nwi->type & WWT_MASK) == NWID_BUTTON_DROPDOWN) { nwi->disp_flags |= ND_DROPDOWN_ACTIVE; } else { - w->LowerWidget(button); + nwi->SetLowered(true); } - w->SetWidgetDirty(button); + nwi->SetDirty(w); if (width != 0) { if (_current_text_dir == TD_RTL) { diff --git a/src/window.cpp b/src/window.cpp index 8782b49056..5de2f8f6cf 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -228,7 +228,7 @@ void Window::DisableAllWidgetHighlight() if (nwid->IsHighlighted()) { nwid->SetHighlighted(TC_INVALID); - this->SetWidgetDirty(i); + nwid->SetDirty(this); } } @@ -248,7 +248,7 @@ void Window::SetWidgetHighlight(byte widget_index, TextColour highlighted_colour if (nwid == nullptr) return; nwid->SetHighlighted(highlighted_colour); - this->SetWidgetDirty(widget_index); + nwid->SetDirty(this); if (highlighted_colour != TC_INVALID) { /* If we set a highlight, the window has a highlight */