From eaa44ab1e15050c5691e7374842c6731d97aa4ef Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 27 Sep 2015 21:55:48 +0100 Subject: [PATCH] Fix #1854. Special track elements disable correctly. Issue was caused by a change I asked to be done a month back. Dropdowns are awkward windows the global array for dropdown content should be populated before creating them but not anything else as that will get reset. In this case the disabled items were reset. The same happens for highlighted index if that is specified before window creation --- src/windows/dropdown.c | 6 +++--- src/windows/ride_construction.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index 3d3bf54c21..4d900297e4 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -179,7 +179,7 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo // Input state _dropdown_highlighted_index = -1; - RCT2_GLOBAL(0x009DED34, sint32) = 0; + *gDropdownItemsDisabled = 0; gDropdownItemsChecked = 0; RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_DROPDOWN_ACTIVE; @@ -258,7 +258,7 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl // Input state _dropdown_highlighted_index = -1; - RCT2_GLOBAL(0x009DED34, sint32) = 0; + *gDropdownItemsDisabled = 0; gDropdownItemsChecked = 0; RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_DROPDOWN_ACTIVE; @@ -337,7 +337,7 @@ static void window_dropdown_paint(rct_window *w, rct_drawpixelinfo *dpi) colour = w->colours[0] & 0x7F; if (i == _dropdown_highlighted_index) colour = 2; - if (RCT2_GLOBAL(0x009DED34, uint32) & (1 << i)) + if (*gDropdownItemsDisabled & (1 << i)) if (i < 32) colour = (w->colours[0] & 0x7F) | 0x40; diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index d119924836..8c0d9394ed 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -3164,7 +3164,6 @@ static void window_ride_construction_show_special_track_dropdown(rct_window *w, RCT2_GLOBAL(0x009DEBA2, sint16) = i; } } - *gDropdownItemsDisabled = RCT2_GLOBAL(0x00F4409C, uint32); window_dropdown_show_text_custom_width( w->x + widget->left, @@ -3175,6 +3174,8 @@ static void window_ride_construction_show_special_track_dropdown(rct_window *w, _numCurrentPossibleRideConfigurations, widget->right - widget->left ); + + *gDropdownItemsDisabled = RCT2_GLOBAL(0x00F4409C, uint32); } /**