From 2d78eace0529a4015b9be2fa671067281522fd22 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 09:39:21 +0100 Subject: [PATCH 1/5] Use QueryInternal in ExecuteInternal. --- src/openrct2/actions/GameAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 5f02c480c2b130a0f58c2c156f040eba009fc49f Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 09:50:10 +0100 Subject: [PATCH 2/5] Fix FootpathRemoveAction crashing with invalid coordinates. --- src/openrct2/actions/FootpathRemoveAction.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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); From 597b0956fccc254001b25e81064c7af19e3733bb Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 09:52:18 +0100 Subject: [PATCH 3/5] Fix SmallSceneryRemoveAction returning no error on invalid coordinates. --- src/openrct2/actions/SmallSceneryRemoveAction.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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); From 7a18fc4b96f777cbe29d94ae29a1ce7cc10c91aa Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 10:02:18 +0100 Subject: [PATCH 4/5] Fix ClearAction breaking out of the loop too early. --- src/openrct2/actions/ClearAction.hpp | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) 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; } From 3f07fd6bed8eb4e695cb6b1cb4b65881650cff58 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 17 Feb 2019 10:06:14 +0100 Subject: [PATCH 5/5] Bump up network version. --- src/openrct2/network/Network.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;