1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.

Similar code is already repeated in other locations.
This commit is contained in:
2021-05-04 00:24:14 +01:00
committed by PeterN
parent 52b16237ad
commit d8e06e590a
5 changed files with 9 additions and 28 deletions

View File

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