mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
* Check for correct peep state when removing mass * Add apply mass function * Increment network version * Fix #13234. Add to changelog
This commit is contained in:
parent
c35b1cf423
commit
9d3f3fa224
5 changed files with 15 additions and 4 deletions
|
@ -26,6 +26,7 @@
|
|||
- Fix: [#11438] Freeze when shrinking map size.
|
||||
- Fix: [#12895] Mechanics are called to repair rides that have already been fixed.
|
||||
- Fix: [#13102] Underflow on height chart (Ride measurements).
|
||||
- Fix: [#13234] Incorrect vehicle mass after using Remove All Guests cheat.
|
||||
- Fix: [#13236] New ride type appears as new vehicle type in research.
|
||||
- Fix: [#13257] Rides that are exactly the minimum objective length are not counted.
|
||||
- Fix: [#13334] Uninitialised variables in CustomTabDesc.
|
||||
|
|
|
@ -644,7 +644,11 @@ void SetCheatAction::RemoveAllGuests() const
|
|||
auto peep = TryGetEntity<Guest>(peepInTrainIndex);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
vehicle->mass -= peep->Mass;
|
||||
if ((peep->State == PeepState::OnRide && peep->RideSubState == PeepRideSubState::OnRide)
|
||||
|| (peep->State == PeepState::LeavingRide && peep->RideSubState == PeepRideSubState::LeaveVehicle))
|
||||
{
|
||||
vehicle->ApplyMass(-peep->Mass);
|
||||
}
|
||||
}
|
||||
peepInTrainIndex = SPRITE_INDEX_NULL;
|
||||
}
|
||||
|
|
|
@ -3836,7 +3836,7 @@ void Guest::UpdateRideEnterVehicle()
|
|||
vehicle->num_peeps++;
|
||||
ride->cur_num_customers++;
|
||||
|
||||
vehicle->mass += seatedGuest->Mass;
|
||||
vehicle->ApplyMass(seatedGuest->Mass);
|
||||
seatedGuest->MoveTo({ LOCATION_NULL, 0, 0 });
|
||||
seatedGuest->SetState(PeepState::OnRide);
|
||||
seatedGuest->GuestTimeOnRide = 0;
|
||||
|
@ -3848,7 +3848,7 @@ void Guest::UpdateRideEnterVehicle()
|
|||
vehicle->num_peeps++;
|
||||
ride->cur_num_customers++;
|
||||
|
||||
vehicle->mass += Mass;
|
||||
vehicle->ApplyMass(Mass);
|
||||
vehicle->Invalidate();
|
||||
|
||||
MoveTo({ LOCATION_NULL, 0, 0 });
|
||||
|
@ -3897,7 +3897,7 @@ void Guest::UpdateRideLeaveVehicle()
|
|||
ActionSpriteImageOffset = 0;
|
||||
|
||||
vehicle->num_peeps--;
|
||||
vehicle->mass -= Mass;
|
||||
vehicle->ApplyMass(-Mass);
|
||||
vehicle->Invalidate();
|
||||
|
||||
if (ride_station >= MAX_STATIONS)
|
||||
|
|
|
@ -825,6 +825,11 @@ uint16_t Vehicle::GetTrackProgress() const
|
|||
return vehicle_get_move_info_size(TrackSubposition, GetTrackType(), GetTrackDirection());
|
||||
}
|
||||
|
||||
void Vehicle::ApplyMass(int16_t appliedMass)
|
||||
{
|
||||
mass = std::clamp<int32_t>(mass + appliedMass, 1, std::numeric_limits<decltype(mass)>::max());
|
||||
}
|
||||
|
||||
void Vehicle::MoveRelativeDistance(int32_t distance)
|
||||
{
|
||||
remaining_distance += distance;
|
||||
|
|
|
@ -371,6 +371,7 @@ struct Vehicle : SpriteBase
|
|||
{
|
||||
update_flags |= flag;
|
||||
}
|
||||
void ApplyMass(int16_t appliedMass);
|
||||
|
||||
private:
|
||||
bool SoundCanPlay() const;
|
||||
|
|
Loading…
Reference in a new issue