mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Fix #20684: Footpath additions getting removed by ghost track elements
This commit is contained in:
@@ -258,16 +258,6 @@ GameActions::Result TrackPlaceAction::Query() const
|
|||||||
}
|
}
|
||||||
costs += canBuild.Cost;
|
costs += canBuild.Cost;
|
||||||
|
|
||||||
// When building a level crossing, remove any pre-existing path furniture.
|
|
||||||
if (crossingMode == CREATE_CROSSING_MODE_TRACK_OVER_PATH)
|
|
||||||
{
|
|
||||||
auto footpathElement = MapGetFootpathElement(mapLoc);
|
|
||||||
if (footpathElement != nullptr && footpathElement->AsPath()->HasAddition())
|
|
||||||
{
|
|
||||||
footpathElement->AsPath()->SetAddition(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto clearanceData = canBuild.GetData<ConstructClearResult>();
|
const auto clearanceData = canBuild.GetData<ConstructClearResult>();
|
||||||
uint8_t mapGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
uint8_t mapGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||||
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
|
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
|
||||||
@@ -478,6 +468,16 @@ GameActions::Result TrackPlaceAction::Execute() const
|
|||||||
}
|
}
|
||||||
costs += canBuild.Cost;
|
costs += canBuild.Cost;
|
||||||
|
|
||||||
|
// When building a level crossing, remove any pre-existing path furniture.
|
||||||
|
if (crossingMode == CREATE_CROSSING_MODE_TRACK_OVER_PATH && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||||
|
{
|
||||||
|
auto footpathElement = MapGetFootpathElement(mapLoc);
|
||||||
|
if (footpathElement != nullptr && footpathElement->AsPath()->HasAddition())
|
||||||
|
{
|
||||||
|
footpathElement->AsPath()->SetAddition(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks)
|
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks)
|
||||||
{
|
{
|
||||||
FootpathRemoveLitter(mapLoc);
|
FootpathRemoveLitter(mapLoc);
|
||||||
|
|||||||
Reference in New Issue
Block a user