1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Merge pull request #21745 from rik-smeets/fix-stuck-boat-hire

Fix #866: Boat Hire boats get stuck entering track
This commit is contained in:
Michael Steenbeek
2024-04-10 12:16:38 +02:00
committed by GitHub
4 changed files with 17 additions and 7 deletions

View File

@@ -3771,7 +3771,7 @@ void Vehicle::UpdateMotionBoatHire()
return;
bool do_Loc6DAA97 = false;
if (sub_state != 1)
if (sub_state != BoatHireSubState::EnteringReturnPosition)
{
do_Loc6DAA97 = true;
}
@@ -3908,12 +3908,12 @@ void Vehicle::UpdateBoatLocation()
if (location.ToTileStart() == returnPosition.ToCoordsXY())
{
sub_state = 1;
sub_state = BoatHireSubState::EnteringReturnPosition;
BoatLocation = location.ToTileStart();
return;
}
sub_state = 0;
sub_state = BoatHireSubState::Normal;
uint8_t curDirection = ((Orientation + 19) >> 3) & 3;
uint8_t randDirection = ScenarioRand() & 3;
@@ -6638,12 +6638,17 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
}
}
if (!mayCollide)
if (!mayCollide || collideVehicle == nullptr)
{
CollisionDetectionTimer = 0;
return false;
}
if (collideVehicle->status == Vehicle::Status::TravellingBoat && sub_state == BoatHireSubState::EnteringReturnPosition)
{
return false;
}
CollisionDetectionTimer++;
if (CollisionDetectionTimer < 200)
{
@@ -6653,8 +6658,6 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
return true;
}
// TODO Is it possible for collideVehicle to be NULL?
if (status == Vehicle::Status::MovingToEndOfStation)
{
if (Orientation == 0)