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
commit 4e7d5d987a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 7 deletions

View File

@ -1,5 +1,6 @@
0.4.11 (in development)
------------------------------------------------------------------------
- Fix: [#866] Boat Hire boats get stuck entering track.
0.4.10 (2024-04-02)
------------------------------------------------------------------------

View File

@ -46,7 +46,7 @@ using namespace OpenRCT2;
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "0"
#define NETWORK_STREAM_VERSION "1"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION

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)

View File

@ -425,6 +425,12 @@ enum class MiniGolfAnimation : uint8_t
Putt,
};
enum BoatHireSubState : uint8_t
{
Normal,
EnteringReturnPosition,
};
namespace VehicleFlags
{
constexpr uint32_t OnLiftHill = (1 << 0);