summaryrefslogtreecommitdiff
path: root/src/widgets/dropdown.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2021-05-04 00:24:14 +0100
committerPeterN <peter@fuzzle.org>2021-05-08 09:53:55 +0100
commitd8e06e590aff56c837b29ddbba3764292ea08d85 (patch)
treebb50b42e03d5e61442ce98d63001426c7dadfa56 /src/widgets/dropdown.cpp
parent52b16237ad863ce30746ac7efc46a9ece7e3bdd2 (diff)
downloadopenttd-d8e06e590aff56c837b29ddbba3764292ea08d85.tar.xz
Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.
Diffstat (limited to 'src/widgets/dropdown.cpp')
-rw-r--r--src/widgets/dropdown.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index 4b89b4809..b6f7de3c1 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -448,12 +448,8 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button,
{
/* Our parent's button widget is used to determine where to place the drop
* down list window. */
- Rect wi_rect;
NWidgetCore *nwi = w->GetWidget<NWidgetCore>(button);
- wi_rect.left = nwi->pos_x;
- wi_rect.right = nwi->pos_x + nwi->current_x - 1;
- wi_rect.top = nwi->pos_y;
- wi_rect.bottom = nwi->pos_y + nwi->current_y - 1;
+ Rect wi_rect = nwi->GetCurrentRect();
Colours wi_colour = nwi->colour;
if ((nwi->type & WWT_MASK) == NWID_BUTTON_DROPDOWN) {