Skip to content

Commit

Permalink
Create Vehicle::IsOnCoveredTrack()
Browse files Browse the repository at this point in the history
In the future, the duplicate covered pieces will be removed and a vehicles and track elements will just have a flag to mark them as “covered”. This eases this transition.
  • Loading branch information
Gymnasiast committed Sep 28, 2024
1 parent 09b66e9 commit 0eb384b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/openrct2/paint/vehicle/VehiclePaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3904,7 +3904,7 @@ static void vehicle_visual_splash5_effect(PaintSession& session, int32_t z, cons
{
return;
}
if (!TrackElementIsCovered(vehicle->GetTrackType()))
if (!vehicle->IsOnCoveredTrack())
{
return;
}
Expand Down
17 changes: 10 additions & 7 deletions src/openrct2/ride/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5370,8 +5370,7 @@ void Vehicle::UpdateTrackMotionUpStopCheck() const
// No up stops (coaster types)
if (carEntry->flags & CAR_ENTRY_FLAG_NO_UPSTOP_WHEELS)
{
auto trackType = GetTrackType();
if (!TrackElementIsCovered(trackType))
if (!IsOnCoveredTrack())
{
auto gForces = GetGForces();
gForces.LateralG = std::abs(gForces.LateralG);
Expand Down Expand Up @@ -5399,8 +5398,7 @@ void Vehicle::UpdateTrackMotionUpStopCheck() const
else if (carEntry->flags & CAR_ENTRY_FLAG_NO_UPSTOP_BOBSLEIGH)
{
// No up stops bobsleigh type
auto trackType = GetTrackType();
if (!TrackElementIsCovered(trackType))
if (!IsOnCoveredTrack())
{
auto gForces = GetGForces();

Expand Down Expand Up @@ -6444,7 +6442,7 @@ void Vehicle::UpdateHandleWaterSplash() const
{
if (IsHead())
{
if (TrackElementIsCovered(trackType))
if (IsOnCoveredTrack())
{
Vehicle* nextVehicle = GetEntity<Vehicle>(next_vehicle_on_ride);
if (nextVehicle == nullptr)
Expand All @@ -6453,7 +6451,7 @@ void Vehicle::UpdateHandleWaterSplash() const
Vehicle* nextNextVehicle = GetEntity<Vehicle>(nextVehicle->next_vehicle_on_ride);
if (nextNextVehicle == nullptr)
return;
if (!TrackElementIsCovered(nextNextVehicle->GetTrackType()))
if (!nextNextVehicle->IsOnCoveredTrack())
{
if (track_progress == 4)
{
Expand Down Expand Up @@ -8701,7 +8699,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
{
if (vehicle->IsHead())
{
if (TrackElementIsCovered(vehicle->GetTrackType()))
if (vehicle->IsOnCoveredTrack())
{
if (vehicle->velocity > 2.0_mph)
{
Expand Down Expand Up @@ -9028,3 +9026,8 @@ void Vehicle::Serialise(DataSerialiser& stream)
stream << BoatLocation;
stream << BlockBrakeSpeed;
}

bool Vehicle::IsOnCoveredTrack() const
{
return TrackElementIsCovered(GetTrackType());
}
1 change: 1 addition & 0 deletions src/openrct2/ride/Vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ struct Vehicle : EntityBase
{
return TrackTypeAndDirection >> 2;
}
bool IsOnCoveredTrack() const;
uint8_t GetTrackDirection() const
{
return TrackTypeAndDirection & VehicleTrackDirectionMask;
Expand Down

0 comments on commit 0eb384b

Please sign in to comment.