From 98501a51f3300a49faa29bfe2419c9dce6f92c99 Mon Sep 17 00:00:00 2001 From: Robert Jordan Date: Tue, 9 Jun 2015 23:05:43 -0400 Subject: [PATCH] Fix Ride is greyed out when it doesn't work --- src/windows/dropdown.c | 1 + src/windows/dropdown.h | 1 + src/windows/ride.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index d993f2fd48..f8581cf490 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -54,6 +54,7 @@ uint16 gDropdownItemsFormat[64]; sint64 gDropdownItemsArgs[64]; // Replaces 0x009DED38 uint32 gDropdownItemsChecked; +uint32 *gDropdownItemsDisabled = RCT2_ADDRESS(0x009DED34, uint32); static void window_dropdown_emptysub() { } static void window_dropdown_paint(); diff --git a/src/windows/dropdown.h b/src/windows/dropdown.h index e2285714e2..c26f140197 100644 --- a/src/windows/dropdown.h +++ b/src/windows/dropdown.h @@ -36,6 +36,7 @@ extern int gDropdownNumItems; extern uint16 gDropdownItemsFormat[64]; extern sint64 gDropdownItemsArgs[64]; extern uint32 gDropdownItemsChecked; +extern uint32 *gDropdownItemsDisabled; void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 flags, int num_items); void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colour, uint8 flags, int num_items, int width); diff --git a/src/windows/ride.c b/src/windows/ride.c index feee0c5d63..df0b243a67 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -3463,7 +3463,7 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc num_items = 1; breakdownReason = ride->breakdown_reason_pending; - if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING))) { + if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING)) { for (i = 0; i < 8; i++) { if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) { if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) { @@ -3480,6 +3480,15 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc } } } + + if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING) == 0 || + breakdownReason == BREAKDOWN_VEHICLE_MALFUNCTION || + breakdownReason == BREAKDOWN_RESTRAINTS_STUCK_CLOSED || + breakdownReason == BREAKDOWN_RESTRAINTS_STUCK_OPEN || + breakdownReason == BREAKDOWN_DOORS_STUCK_CLOSED || + breakdownReason == BREAKDOWN_DOORS_STUCK_OPEN) { + *gDropdownItemsDisabled = (1 << 0); + } } break; }