1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 06:23:04 +01:00

Remove double check in LandSetHeightAction (#17027)

This commit is contained in:
jensj12
2022-05-17 03:12:19 +02:00
committed by GitHub
parent 4adca3ba15
commit d071693808
2 changed files with 2 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
* Copyright (c) 2014-2022 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
@@ -134,14 +134,6 @@ GameActions::Result LandSetHeightAction::Query() const
clearResult.Error = GameActions::Status::Disallowed;
return clearResult;
}
tileElement = CheckUnremovableObstructions(reinterpret_cast<TileElement*>(surfaceElement), zCorner);
if (tileElement != nullptr)
{
auto res = GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_NONE);
map_obstruction_set_error_text(tileElement, res);
return res;
}
}
auto res = GameActions::Result();
res.Cost = sceneryRemovalCost + GetSurfaceHeightChangeCost(surfaceElement);
@@ -322,37 +314,6 @@ TileElement* LandSetHeightAction::CheckFloatingStructures(TileElement* surfaceEl
return nullptr;
}
TileElement* LandSetHeightAction::CheckUnremovableObstructions(TileElement* surfaceElement, uint8_t zCorner) const
{
for (auto* tileElement : TileElementsView(_coords))
{
const auto elementType = tileElement->GetType();
// Wall's and Small Scenery are removed and therefore do not need checked
if (elementType == TileElementType::Wall)
continue;
if (elementType == TileElementType::SmallScenery)
continue;
if (tileElement->IsGhost())
continue;
if (tileElement == surfaceElement)
continue;
if (tileElement > surfaceElement)
{
if (zCorner > tileElement->base_height)
{
return tileElement;
}
continue;
}
if (_height < tileElement->clearance_height)
{
return tileElement;
}
}
return nullptr;
}
money32 LandSetHeightAction::GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const
{
money32 cost{ 0 };

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
* Copyright (c) 2014-2022 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
@@ -35,7 +35,6 @@ private:
void SmallSceneryRemoval() const;
rct_string_id CheckRideSupports() const;
TileElement* CheckFloatingStructures(TileElement* surfaceElement, uint8_t zCorner) const;
TileElement* CheckUnremovableObstructions(TileElement* surfaceElement, uint8_t zCorner) const;
money32 GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const;
void SetSurfaceHeight(TileElement* surfaceElement) const;