fix unable to place entrance / exit as a client

This commit is contained in:
IntelOrca 2016-03-03 21:53:07 +00:00
parent 6ec5fc8cec
commit 4c6c354093
3 changed files with 35 additions and 1 deletions

View File

@ -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();
}

View File

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

View File

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