Fix slow guests don't get across level crossing in time (#18453)

This commit is contained in:
Rik Smeets 2022-10-31 19:57:50 +01:00 committed by GitHub
parent 787acb903b
commit 6faddd94f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View File

@ -22,6 +22,7 @@
- Fix: [#18379] Tunnel entrances for underground Mini Golf Hole E are not rendered correctly.
- Fix: [#18442] About window background is clickable.
- Fix: [#18449] [Plugin] Change type of listview widgets from 'scroll_view' to 'listview'.
- Fix: [#18453] Slow walking guests don't get across level crossings in time.
0.4.2 (2022-10-05)
------------------------------------------------------------------------

View File

@ -323,13 +323,13 @@ bool Peep::CheckForPath()
bool Peep::ShouldWaitForLevelCrossing()
{
auto curPos = TileCoordsXYZ(GetLocation());
if (FootpathIsBlockedByVehicle(curPos))
if (IsOnPathBlockedByVehicle())
{
// If current position is blocked, try to get out of the way
// Try to get out of the way
return false;
}
auto curPos = TileCoordsXYZ(GetLocation());
auto dstPos = TileCoordsXYZ(CoordsXYZ{ GetDestination(), NextLoc.z });
if ((curPos.x != dstPos.x || curPos.y != dstPos.y) && FootpathIsBlockedByVehicle(dstPos))
{
@ -345,6 +345,12 @@ bool Peep::IsOnLevelCrossing()
return trackElement != nullptr;
}
bool Peep::IsOnPathBlockedByVehicle()
{
auto curPos = TileCoordsXYZ(GetLocation());
return FootpathIsBlockedByVehicle(curPos);
}
PeepActionSpriteType Peep::GetActionSpriteType()
{
if (IsActionInterruptable())
@ -982,6 +988,10 @@ void Peep::Update()
if (State == PeepState::Queuing)
stepsToTake += stepsToTake / 2;
}
// Ensure guests make it across a level crossing in time
constexpr auto minStepsForCrossing = 55;
if (stepsToTake < minStepsForCrossing && IsOnPathBlockedByVehicle())
stepsToTake = minStepsForCrossing;
uint32_t carryCheck = StepProgress + stepsToTake;
StepProgress = carryCheck;

View File

@ -414,6 +414,7 @@ public: // Peep
[[nodiscard]] bool CheckForPath();
bool ShouldWaitForLevelCrossing();
bool IsOnLevelCrossing();
bool IsOnPathBlockedByVehicle();
void PerformNextAction(uint8_t& pathing_result);
void PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result);
[[nodiscard]] int32_t GetZOnSlope(int32_t tile_x, int32_t tile_y);

View File

@ -43,7 +43,7 @@
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "4"
#define NETWORK_STREAM_VERSION "5"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION