Merge individual x,y variables into ScreenCoordsXY object

This commit is contained in:
Tulio Leao 2020-05-01 16:03:21 -03:00
parent d0704baab2
commit c5180a00b8
2 changed files with 7 additions and 9 deletions

View File

@ -272,8 +272,6 @@ static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollInd
const auto& server = _serverList.GetServer(serverIndex);
auto listWidget = &w->widgets[WIDX_LIST];
int32_t ddx = w->windowPos.x + listWidget->left + screenCoords.x + 2 - w->scrolls[0].h_left;
int32_t ddy = w->windowPos.y + listWidget->top + screenCoords.y + 2 - w->scrolls[0].v_top;
gDropdownItemsFormat[0] = STR_JOIN_GAME;
if (server.favourite)
@ -284,7 +282,9 @@ static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollInd
{
gDropdownItemsFormat[1] = STR_ADD_TO_FAVOURITES;
}
window_dropdown_show_text({ ddx, ddy }, 0, COLOUR_GREY, 0, 2);
auto dropdownPos = ScreenCoordsXY{ w->windowPos.x + listWidget->left + screenCoords.x + 2 - w->scrolls[0].h_left,
w->windowPos.y + listWidget->top + screenCoords.y + 2 - w->scrolls[0].v_top };
window_dropdown_show_text(dropdownPos, 0, COLOUR_GREY, 0, 2);
}
}

View File

@ -567,10 +567,9 @@ void window_staff_overview_mousedown(rct_window* w, rct_widgetindex widgetIndex,
gDropdownItemsFormat[0] = STR_SET_PATROL_AREA;
gDropdownItemsFormat[1] = STR_CLEAR_PATROL_AREA;
int32_t x = widget->left + w->windowPos.x;
int32_t y = widget->top + w->windowPos.y;
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
int32_t extray = widget->bottom - widget->top + 1;
window_dropdown_show_text({ x, y }, extray, w->colours[1], 0, 2);
window_dropdown_show_text(dropdownPos, extray, w->colours[1], 0, 2);
gDropdownDefaultIndex = 0;
Peep* peep = GET_PEEP(w->number);
@ -1433,11 +1432,10 @@ void window_staff_options_mousedown(rct_window* w, rct_widgetindex widgetIndex,
// Get the dropdown box widget instead of button.
widget--;
int32_t x = widget->left + w->windowPos.x;
int32_t y = widget->top + w->windowPos.y;
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
int32_t extray = widget->bottom - widget->top + 1;
int32_t width = widget->right - widget->left - 3;
window_dropdown_show_text_custom_width({ x, y }, extray, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numCostumes, width);
window_dropdown_show_text_custom_width(dropdownPos, extray, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numCostumes, width);
// See above note.
if (checkedIndex != -1)