mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Merge pull request #9403 from duncanspumpkin/fix_9396
Fix #9396. Pass the ghost flag to banner remove to prevent invalid removal
This commit is contained in:
@@ -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<uint32_t>(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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user