1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 00:04:43 +01:00

Move some game actions logic from header to source (#13571)

* Moving all definitions from B...Actions to source

* Moving all definitions from C...Actions to source

* Moving all definitions from F...Actions to source

* Moving all definitions from G...Actions to source

* Moving all definitions from L...Actions to source

* Moving all definitions from M...Actions to source

* Moving all definitions from N...Actions to source

* Moving all definitions from P...Actions to source
This commit is contained in:
Tulio Leao
2020-12-13 12:10:26 -03:00
committed by GitHub
parent 04b26631c0
commit 8fc167afc3
84 changed files with 666 additions and 482 deletions

View File

@@ -24,6 +24,12 @@
#include <algorithm>
ClearAction::ClearAction(MapRange range, ClearableItems itemsToClear)
: _range(range)
, _itemsToClear(itemsToClear)
{
}
void ClearAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
@@ -200,3 +206,29 @@ money32 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executin
return totalCost;
}
void ClearAction::ResetClearLargeSceneryFlag()
{
// TODO: Improve efficiency of this
for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
{
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
{
auto tileElement = map_get_first_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
do
{
if (tileElement == nullptr)
break;
if (tileElement->GetType() == TILE_ELEMENT_TYPE_LARGE_SCENERY)
{
tileElement->AsLargeScenery()->SetIsAccounted(false);
}
} while (!(tileElement++)->IsLastForTile());
}
}
}
bool ClearAction::MapCanClearAt(const CoordsXY& location)
{
return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode || map_is_location_owned_or_has_rights(location);
}