1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Fix dropdown location at sides of the screen #690

This commit is contained in:
Duncan Frost
2015-01-17 09:14:17 +00:00
parent 0ff125b9b3
commit e2b2c94ca1

View File

@@ -150,6 +150,14 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo
// Set the widgets
gDropdownNumItems = num_items;
_dropdown_num_rows = num_items;
width = _dropdown_item_width * _dropdown_num_columns + 3;
int height = _dropdown_item_height * _dropdown_num_rows + 3;
if (x + width > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16))
x = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - width);
if (y + height > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16))
y = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - height);
window_dropdown_widgets[WIDX_BACKGROUND].bottom = _dropdown_item_height * num_items + 3;
window_dropdown_widgets[WIDX_BACKGROUND].right = _dropdown_item_width + 3;