diff --git a/src/ride/ride.c b/src/ride/ride.c index b935da6d1f..e24b0d186e 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -6013,6 +6013,7 @@ void game_command_callback_ride_construct_placed_back(int eax, int ebx, int ecx, _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; } + window_ride_construction_do_station_check(); sub_6C84CE(); } @@ -6045,6 +6046,8 @@ void game_command_callback_ride_construct_placed_front(int eax, int ebx, int ecx _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; } + window_ride_construction_do_station_check(); + window_ride_construction_do_entrance_exit_check(); sub_6C84CE(); } diff --git a/src/ride/ride.h b/src/ride/ride.h index e2b041465e..91e17b49b5 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -1057,4 +1057,8 @@ const uint32 ride_customers_per_hour(const rct_ride *ride); const uint32 ride_customers_in_last_5_minutes(const rct_ride *ride); rct_vehicle * ride_get_broken_vehicle(rct_ride *ride); + +void window_ride_construction_do_station_check(); +void window_ride_construction_do_entrance_exit_check(); + #endif diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 78192462ca..8783e8852e 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -1684,7 +1684,7 @@ static void window_ride_construction_construct(rct_window *w) } } - _stationConstructed = get_ride(w->number)->num_stations != 0; + window_ride_construction_do_station_check(); // returning early here makes it so that the construction window doesn't blink if (network_get_mode() == NETWORK_MODE_CLIENT) @@ -3948,3 +3948,30 @@ static void ride_construction_tooldown_entrance_exit(int screenX, int screenY) WIDX_ENTRANCE : WIDX_EXIT; } } + +void window_ride_construction_do_station_check() +{ + rct_ride *ride = get_ride(_currentRideIndex); + if (ride != NULL) { + _stationConstructed = ride->num_stations != 0; + } +} + +void window_ride_construction_do_entrance_exit_check() +{ + rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_ride *ride = get_ride(_currentRideIndex); + + if (w == NULL || ride == NULL) { + return; + } + + if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_0) { + w = window_find_by_class(WC_RIDE_CONSTRUCTION); + if (w != NULL) { + if (!ride_are_all_possible_entrances_and_exits_built(ride)) { + window_event_mouse_up_call(w, WIDX_ENTRANCE); + } + } + } +}