From 2da64715cc10a9cabbb768aa9a69121eee89dfe8 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 9 Jun 2021 17:55:23 +0200 Subject: [PATCH] Directly call MapCanConstructWithClearAt() --- src/openrct2/actions/FootpathPlaceAction.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index 2662388e1d..be84fabf90 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -313,14 +313,14 @@ GameActions::Result::Ptr FootpathPlaceAction::ElementInsertExecute(GameActions:: uint8_t crossingMode = (_type & FOOTPATH_ELEMENT_INSERT_QUEUE) || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE : CREATE_CROSSING_MODE_PATH_OVER_TRACK; - if (!entrancePath - && !map_can_construct_with_clear_at( - { _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), - &res->Cost, crossingMode)) + auto canBuild = MapCanConstructWithClearAt( + { _loc, zLow, zHigh }, &map_place_non_scenery_clear_func, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), + crossingMode); + if (!entrancePath && canBuild->Error != GameActions::Status::Ok) { - return MakeResult( - GameActions::Status::NoClearance, STR_CANT_BUILD_FOOTPATH_HERE, gGameCommandErrorText, gCommonFormatArgs); + return canBuild; } + res->Cost += canBuild->Cost; gFootpathGroundFlags = gMapGroundFlags;