mirror of https://github.com/OpenRCT2/OpenRCT2.git
Finished waiting for passengers. Bugs encountered
This commit is contained in:
parent
392815cd0c
commit
fe6e0a11fa
|
@ -943,7 +943,7 @@ static void ride_remove_vehicles(rct_ride *ride)
|
|||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
ride->var_066[i] = 255;
|
||||
ride->train_at_station[i] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1145,6 +1145,58 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
}
|
||||
}
|
||||
|
||||
/* 0x006D7FB4 */
|
||||
static void train_ready_to_depart(rct_vehicle* vehicle, uint8 num_peeps_on_train, uint8 num_used_seats){
|
||||
|
||||
if (num_peeps_on_train != num_used_seats)
|
||||
return;
|
||||
|
||||
rct_ride* ride = GET_RIDE(vehicle->ride);
|
||||
|
||||
if (ride->status == RIDE_STATUS_OPEN &&
|
||||
!(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) &&
|
||||
!(vehicle->var_48 & (1<<4))){
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)){
|
||||
if (ride->status != RIDE_STATUS_CLOSED ||
|
||||
ride->num_riders != 0){
|
||||
ride->train_at_station[vehicle->current_station] = 0xFF;
|
||||
vehicle->var_51 = 2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ride->mode == RIDE_MODE_FORWARD_ROTATION ||
|
||||
ride->mode == RIDE_MODE_BACKWARD_ROTATION){
|
||||
|
||||
uint8 peep = ((-vehicle->var_1F) / 8) & 0xF;
|
||||
if (vehicle->peep[peep] != 0xFFFF){
|
||||
ride->train_at_station[vehicle->current_station] = 0xFF;
|
||||
vehicle->status = VEHICLE_STATUS_UNLOADING_PASSENGERS;
|
||||
vehicle->var_51 = 2;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vehicle->num_peeps == 0)
|
||||
return;
|
||||
|
||||
ride->train_at_station[vehicle->current_station] = 0xFF;
|
||||
vehicle->var_51 = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_peeps_on_train == 0)
|
||||
return;
|
||||
|
||||
ride->train_at_station[vehicle->current_station] = 0xFF;
|
||||
vehicle->status = VEHICLE_STATUS_UNLOADING_PASSENGERS;
|
||||
vehicle->var_51 = 2;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
}
|
||||
|
||||
/* 0x006D7DA1 */
|
||||
static void vehicle_update_waiting_for_passengers(rct_vehicle* vehicle){
|
||||
vehicle->velocity = 0;
|
||||
|
@ -1197,24 +1249,31 @@ static void vehicle_update_waiting_for_passengers(rct_vehicle* vehicle){
|
|||
|
||||
if (!(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & RIDE_TYPE_FLAG_NO_TEST_MODE)){
|
||||
if (vehicle->var_C0 < 20){
|
||||
//0x6D7FB9
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (num_peeps_on_train == 0){
|
||||
//0x6D7FB9
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & RIDE_TYPE_FLAG_HAS_LOAD_OPTIONS){
|
||||
if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH){
|
||||
if (ride->min_waiting_time * 32 > vehicle->var_C0){
|
||||
//0x6D7FB9
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH){
|
||||
if (ride->max_waiting_time * 32 < vehicle->var_C0){
|
||||
//***0x6D7FB4
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1234,14 +1293,85 @@ static void vehicle_update_waiting_for_passengers(rct_vehicle* vehicle){
|
|||
if (train->status == VEHICLE_STATUS_UNLOADING_PASSENGERS ||
|
||||
train->status == VEHICLE_STATUS_MOVING_TO_END_OF_STATION){
|
||||
if (train->current_station == vehicle->current_station){
|
||||
//0x6d7FB4
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//0x6d7f49
|
||||
|
||||
if (RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & RIDE_TYPE_FLAG_HAS_LOAD_OPTIONS &&
|
||||
ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD){
|
||||
|
||||
if (num_peeps_on_train == num_seats_on_train){
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 load = ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK;
|
||||
if (load == 3){
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 three_quater_seats = (3 * num_seats_on_train) / 4;
|
||||
if (three_quater_seats != 0 && num_peeps_on_train >= three_quater_seats){
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (load == 2){
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_seats_on_train / 2 != 0 && num_peeps_on_train >= num_seats_on_train / 2){
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (load == 1){
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_seats_on_train / 4 != 0 && num_peeps_on_train >= num_seats_on_train / 4){
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (load == 0){
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_peeps_on_train != 0){
|
||||
vehicle->var_48 |= (1 << 4);
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
}
|
||||
train_ready_to_depart(vehicle, num_peeps_on_train, num_used_seats_on_train);
|
||||
return;
|
||||
}
|
||||
//0x6d8085
|
||||
|
||||
if (RCT2_CALLPROC_X(0x006D6956, 0, 0, 0, 0, (int)vehicle, 0, 0) & 0x100)
|
||||
return;
|
||||
|
||||
vehicle->velocity = 0;
|
||||
vehicle->status = VEHICLE_STATUS_DEPARTING;
|
||||
vehicle->var_51 = 0;
|
||||
vehicle->var_48 &= ~(1 << 2);
|
||||
|
||||
if (ride->depart_flags & RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS){
|
||||
vehicle->var_48 |= (1 << 2);
|
||||
}
|
||||
|
||||
vehicle_invalidate_window(vehicle);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue