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.
This commit is contained in:
IntelOrca 2016-02-27 01:20:21 +00:00
parent d769806f17
commit c7c1f862cc
2 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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: