mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Fix crash when ducks try to navigate out of bounds
This commit is contained in:
@@ -124,7 +124,7 @@ void rct_duck::UpdateFlyToWater()
|
|||||||
int32_t manhattanDistanceN = abs(target_x - newX) + abs(target_y - newY);
|
int32_t manhattanDistanceN = abs(target_x - newX) + abs(target_y - newY);
|
||||||
|
|
||||||
auto surfaceElement = map_get_surface_element_at({ target_x, target_y });
|
auto surfaceElement = map_get_surface_element_at({ target_x, target_y });
|
||||||
int32_t waterHeight = surfaceElement->GetWaterHeight();
|
int32_t waterHeight = surfaceElement != nullptr ? surfaceElement->GetWaterHeight() : 0;
|
||||||
if (waterHeight == 0)
|
if (waterHeight == 0)
|
||||||
{
|
{
|
||||||
state = DUCK_STATE::FLY_AWAY;
|
state = DUCK_STATE::FLY_AWAY;
|
||||||
|
|||||||
Reference in New Issue
Block a user