diff --git a/src/openrct2/actions/ClearAction.hpp b/src/openrct2/actions/ClearAction.hpp index 2f30df8a9f..031895f193 100644 --- a/src/openrct2/actions/ClearAction.hpp +++ b/src/openrct2/actions/ClearAction.hpp @@ -158,11 +158,11 @@ private: auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction) : GameActions::QueryNested(&footpathRemoveAction); - if (res->Error != GA_ERROR::OK) - return MONEY32_UNDEFINED; - - totalCost += res->Cost; - tileEdited = executing; + if (res->Error == GA_ERROR::OK) + { + totalCost += res->Cost; + tileEdited = executing; + } } break; case TILE_ELEMENT_TYPE_SMALL_SCENERY: @@ -176,11 +176,11 @@ private: auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction) : GameActions::QueryNested(&removeSceneryAction); - if (res->Error != GA_ERROR::OK) - return MONEY32_UNDEFINED; - - totalCost += res->Cost; - tileEdited = executing; + if (res->Error == GA_ERROR::OK) + { + totalCost += res->Cost; + tileEdited = executing; + } } break; case TILE_ELEMENT_TYPE_WALL: @@ -193,11 +193,11 @@ private: auto res = executing ? GameActions::ExecuteNested(&wallRemoveAction) : GameActions::QueryNested(&wallRemoveAction); - if (res->Error != GA_ERROR::OK) - return MONEY32_UNDEFINED; - - totalCost += res->Cost; - tileEdited = executing; + if (res->Error == GA_ERROR::OK) + { + totalCost += res->Cost; + tileEdited = executing; + } } break; case TILE_ELEMENT_TYPE_LARGE_SCENERY: @@ -211,11 +211,11 @@ private: auto res = executing ? GameActions::ExecuteNested(&removeSceneryAction) : GameActions::QueryNested(&removeSceneryAction); - if (res->Error != GA_ERROR::OK) - return MONEY32_UNDEFINED; - - totalCost += res->Cost; - tileEdited = executing; + if (res->Error == GA_ERROR::OK) + { + totalCost += res->Cost; + tileEdited = executing; + } } break; } diff --git a/src/openrct2/actions/FootpathRemoveAction.hpp b/src/openrct2/actions/FootpathRemoveAction.hpp index 61eaed8dbf..8e7335bf53 100644 --- a/src/openrct2/actions/FootpathRemoveAction.hpp +++ b/src/openrct2/actions/FootpathRemoveAction.hpp @@ -62,6 +62,11 @@ public: } TileElement* footpathElement = GetFootpathElement(); + if (footpathElement == nullptr) + { + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE); + } + res->Cost = GetRefundPrice(footpathElement); return res; @@ -90,6 +95,10 @@ public: tile_element_remove(footpathElement); footpath_update_queue_chains(); } + else + { + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE); + } res->Cost = GetRefundPrice(footpathElement); diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index b564891e0e..69bb3445cf 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -261,7 +261,7 @@ namespace GameActions } } - GameActionResult::Ptr result = Query(action); + GameActionResult::Ptr result = QueryInternal(action, topLevel); if (result->Error == GA_ERROR::OK) { if (topLevel) diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.hpp b/src/openrct2/actions/SmallSceneryRemoveAction.hpp index 60d6ab1925..499099afb5 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.hpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.hpp @@ -104,8 +104,7 @@ public: TileElement* tileElement = FindSceneryElement(); if (tileElement == nullptr) { - res->Cost = 0; - return res; + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } return res; @@ -130,8 +129,7 @@ public: TileElement* tileElement = FindSceneryElement(); if (tileElement == nullptr) { - res->Cost = 0; - return res; + return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } res->Position.z = tile_element_height(res->Position.x, res->Position.y); diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 89690a141b..67642ca015 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -30,7 +30,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "37" +#define NETWORK_STREAM_VERSION "38" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static rct_peep* _pickup_peep = nullptr;