mirror of https://github.com/OpenRCT2/OpenRCT2.git
Part of #9473: Create Vehicle::UpdateTestFinish
Converted from vehicle_update_test_finish
This commit is contained in:
parent
28c861ee7e
commit
49be02dbfd
|
@ -2996,14 +2996,13 @@ void Vehicle::PeepEasterEggHereWeAre() const
|
||||||
* Performed when vehicle has completed a full circuit
|
* Performed when vehicle has completed a full circuit
|
||||||
* rct2: 0x006D7338
|
* rct2: 0x006D7338
|
||||||
*/
|
*/
|
||||||
void vehicle_update_test_finish(Vehicle* vehicle)
|
static bool test_finish(ride_id_t rideId)
|
||||||
{
|
{
|
||||||
auto ride = get_ride(vehicle->ride);
|
auto ride = get_ride(rideId);
|
||||||
if (ride == nullptr)
|
if (ride == nullptr)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS;
|
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS;
|
||||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_TESTING;
|
|
||||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
||||||
|
|
||||||
for (int32_t i = ride->num_stations - 1; i >= 1; i--)
|
for (int32_t i = ride->num_stations - 1; i >= 1; i--)
|
||||||
|
@ -3028,8 +3027,16 @@ void vehicle_update_test_finish(Vehicle* vehicle)
|
||||||
|
|
||||||
totalTime = std::max(totalTime, 1u);
|
totalTime = std::max(totalTime, 1u);
|
||||||
ride->average_speed = ride->average_speed / totalTime;
|
ride->average_speed = ride->average_speed / totalTime;
|
||||||
|
window_invalidate_by_number(WC_RIDE, rideId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
window_invalidate_by_number(WC_RIDE, vehicle->ride);
|
void Vehicle::UpdateTestFinish()
|
||||||
|
{
|
||||||
|
if (!test_finish(ride))
|
||||||
|
return;
|
||||||
|
|
||||||
|
update_flags &= ~VEHICLE_UPDATE_FLAG_TESTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3202,7 +3209,7 @@ void Vehicle::UpdateDeparting()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vehicle_update_test_finish(this);
|
UpdateTestFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TEST_IN_PROGRESS) && !IsGhost())
|
else if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TEST_IN_PROGRESS) && !IsGhost())
|
||||||
|
@ -4067,7 +4074,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED) && update_flags & VEHICLE_UPDATE_FLAG_TESTING
|
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED) && update_flags & VEHICLE_UPDATE_FLAG_TESTING
|
||||||
&& curRide->current_test_segment + 1 >= curRide->num_stations)
|
&& curRide->current_test_segment + 1 >= curRide->num_stations)
|
||||||
{
|
{
|
||||||
vehicle_update_test_finish(this);
|
UpdateTestFinish();
|
||||||
}
|
}
|
||||||
SetState(VEHICLE_STATUS_MOVING_TO_END_OF_STATION);
|
SetState(VEHICLE_STATUS_MOVING_TO_END_OF_STATION);
|
||||||
return;
|
return;
|
||||||
|
@ -4107,7 +4114,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED) && update_flags & VEHICLE_UPDATE_FLAG_TESTING
|
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED) && update_flags & VEHICLE_UPDATE_FLAG_TESTING
|
||||||
&& curRide->current_test_segment + 1 >= curRide->num_stations)
|
&& curRide->current_test_segment + 1 >= curRide->num_stations)
|
||||||
{
|
{
|
||||||
vehicle_update_test_finish(this);
|
UpdateTestFinish();
|
||||||
}
|
}
|
||||||
SetState(VEHICLE_STATUS_MOVING_TO_END_OF_STATION);
|
SetState(VEHICLE_STATUS_MOVING_TO_END_OF_STATION);
|
||||||
}
|
}
|
||||||
|
@ -4173,7 +4180,7 @@ void Vehicle::UpdateTravellingCableLift()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vehicle_update_test_finish(this);
|
UpdateTestFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TEST_IN_PROGRESS) && !IsGhost())
|
else if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TEST_IN_PROGRESS) && !IsGhost())
|
||||||
|
|
|
@ -361,6 +361,7 @@ private:
|
||||||
bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
||||||
bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
||||||
void TestReset();
|
void TestReset();
|
||||||
|
void UpdateTestFinish();
|
||||||
void PeepEasterEggHereWeAre() const;
|
void PeepEasterEggHereWeAre() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -562,7 +563,6 @@ void vehicle_set_map_toolbar(const Vehicle* vehicle);
|
||||||
int32_t vehicle_is_used_in_pairs(const Vehicle* vehicle);
|
int32_t vehicle_is_used_in_pairs(const Vehicle* vehicle);
|
||||||
int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle);
|
int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle);
|
||||||
void vehicle_invalidate_window(Vehicle* vehicle);
|
void vehicle_invalidate_window(Vehicle* vehicle);
|
||||||
void vehicle_update_test_finish(Vehicle* vehicle);
|
|
||||||
const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset);
|
const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset);
|
||||||
uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection);
|
uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue