From c7c1f862cc4afac4cb4f55e9d7814d98f6cdc20d Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 27 Feb 2016 01:20:21 +0000 Subject: [PATCH] fix #2878: Shops and stalls doesn't open on the server with auto open Use the set status game command instead of setting the status of the ride directly. In order to stop stack overflow, closing the ride construction window is now done in the update event for that window. --- src/ride/ride.c | 2 -- src/windows/ride_construction.c | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ride/ride.c b/src/ride/ride.c index 15cd5acbca..f62719dd24 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -5152,8 +5152,6 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying) ride = get_ride(rideIndex); - window_close_by_number(WC_RIDE_CONSTRUCTION, rideIndex); - stationIndex = ride_mode_check_station_present(ride); if (stationIndex == -1)return 0; diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index c35dfd35d3..25b1dfb217 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -593,7 +593,7 @@ static void window_ride_construction_close(rct_window *w) if (ride_try_get_origin_element(rideIndex, NULL)) { rct_ride *ride = get_ride(rideIndex); if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) { - ride->status = RIDE_STATUS_OPEN; + ride_set_status(rideIndex, RIDE_STATUS_OPEN); } window_ride_main_open(rideIndex); @@ -1926,6 +1926,12 @@ static void window_ride_construction_exit_click(rct_window *w) */ static void window_ride_construction_update(rct_window *w) { + rct_ride *ride = get_ride(_currentRideIndex); + if (ride == NULL || ride->status != RIDE_STATUS_CLOSED) { + window_close(w); + return; + } + switch (_currentTrackCurve) { case 429: case 376: