diff --git a/src/openrct2/actions/FootpathRemoveAction.hpp b/src/openrct2/actions/FootpathRemoveAction.hpp index 34d8fce962..7f7adb7858 100644 --- a/src/openrct2/actions/FootpathRemoveAction.hpp +++ b/src/openrct2/actions/FootpathRemoveAction.hpp @@ -90,7 +90,11 @@ public: if (footpathElement != nullptr) { footpath_queue_chain_reset(); - RemoveBannersAtElement(_x, _y, footpathElement); + auto bannerRes = RemoveBannersAtElement(_x, _y, footpathElement); + if (bannerRes->Error == GA_ERROR::OK) + { + res->Cost += bannerRes->Cost; + } footpath_remove_edges_at(_x, _y, footpathElement); map_invalidate_tile_full(_x, _y); tile_element_remove(footpathElement); @@ -101,7 +105,7 @@ public: return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_FOOTPATH_FROM_HERE); } - res->Cost = GetRefundPrice(footpathElement); + res->Cost += GetRefundPrice(footpathElement); return res; } @@ -146,20 +150,29 @@ private: * * rct2: 0x006BA23E */ - void RemoveBannersAtElement(int32_t x, int32_t y, TileElement * tileElement) const + GameActionResult::Ptr RemoveBannersAtElement(int32_t x, int32_t y, TileElement * tileElement) const { + auto result = MakeResult(); while (!(tileElement++)->IsLastForTile()) { if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) - return; + return result; else if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER) continue; auto bannerRemoveAction = BannerRemoveAction( { x, y, tileElement->base_height * 8, tileElement->AsBanner()->GetPosition() }); - bannerRemoveAction.SetFlags(GetFlags()); - GameActions::ExecuteNested(&bannerRemoveAction); + bool isGhost = tileElement->IsGhost(); + auto bannerFlags = GetFlags() | (isGhost ? static_cast(GAME_COMMAND_FLAG_GHOST) : 0); + bannerRemoveAction.SetFlags(bannerFlags); + auto res = GameActions::ExecuteNested(&bannerRemoveAction); + // Ghost removal is free + if (res->Error == GA_ERROR::OK && !isGhost) + { + result->Cost += res->Cost; + } tileElement--; } + return result; } }; diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index aa1f25d998..cdb9d41643 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -33,7 +33,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 "41" +#define NETWORK_STREAM_VERSION "42" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr;