From d071693808f1024a3237c5f65be31acb16968e2a Mon Sep 17 00:00:00 2001 From: jensj12 Date: Tue, 17 May 2022 03:12:19 +0200 Subject: [PATCH] Remove double check in LandSetHeightAction (#17027) --- src/openrct2/actions/LandSetHeightAction.cpp | 41 +------------------- src/openrct2/actions/LandSetHeightAction.h | 3 +- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index 4cb0035dfa..d238b89a5a 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -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(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 }; diff --git a/src/openrct2/actions/LandSetHeightAction.h b/src/openrct2/actions/LandSetHeightAction.h index a9b75e9a58..9fbbe58dea 100644 --- a/src/openrct2/actions/LandSetHeightAction.h +++ b/src/openrct2/actions/LandSetHeightAction.h @@ -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;