1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 17:54:50 +01:00

Part of #21421: Refactor MAXIMUM_MAP_SIZE_TECHNICAL

This commit is contained in:
Claudio Tiecher
2024-03-17 14:41:36 +01:00
parent ef81a6376e
commit ffb8b4d44b
14 changed files with 49 additions and 49 deletions

View File

@@ -152,7 +152,7 @@ void SetTileElements(std::vector<TileElement>&& tileElements)
auto& gameState = GetGameState();
gameState.TileElements = std::move(tileElements);
_tileIndex = TilePointerIndex<TileElement>(
MAXIMUM_MAP_SIZE_TECHNICAL, gameState.TileElements.data(), gameState.TileElements.size());
kMaximumMapSizeTechnical, gameState.TileElements.data(), gameState.TileElements.size());
_tileElementsInUse = gameState.TileElements.size();
}
@@ -177,9 +177,9 @@ std::vector<TileElement> GetReorganisedTileElementsWithoutGhosts()
{
std::vector<TileElement> newElements;
newElements.reserve(std::max(MIN_TILE_ELEMENTS, GetGameState().TileElements.size()));
for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++)
{
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++)
{
auto oldSize = newElements.size();
@@ -217,9 +217,9 @@ static void ReorganiseTileElements(size_t capacity)
std::vector<TileElement> newElements;
newElements.reserve(std::max(MIN_TILE_ELEMENTS, capacity));
for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++)
{
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++)
{
const auto* element = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (element == nullptr)
@@ -336,8 +336,8 @@ void TileElementIteratorRestartForTile(TileElementIterator* it)
static bool IsTileLocationValid(const TileCoordsXY& coords)
{
const bool is_x_valid = coords.x < MAXIMUM_MAP_SIZE_TECHNICAL && coords.x >= 0;
const bool is_y_valid = coords.y < MAXIMUM_MAP_SIZE_TECHNICAL && coords.y >= 0;
const bool is_x_valid = coords.x < kMaximumMapSizeTechnical && coords.x >= 0;
const bool is_y_valid = coords.y < kMaximumMapSizeTechnical && coords.y >= 0;
return is_x_valid && is_y_valid;
}
@@ -454,7 +454,7 @@ BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t positio
*/
void MapInit(const TileCoordsXY& size)
{
auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL;
auto numTiles = kMaximumMapSizeTechnical * kMaximumMapSizeTechnical;
SetTileElements(std::vector<TileElement>(numTiles, GetDefaultSurfaceElement()));
auto& gameState = GetGameState();
@@ -1420,7 +1420,7 @@ static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile,
void MapExtendBoundarySurfaceY()
{
auto y = GetGameState().MapSize.y - 2;
for (auto x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
for (auto x = 0; x < kMaximumMapSizeTechnical; x++)
{
auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y - 1 });
auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y });
@@ -1440,7 +1440,7 @@ void MapExtendBoundarySurfaceY()
void MapExtendBoundarySurfaceX()
{
auto x = GetGameState().MapSize.x - 2;
for (auto y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
for (auto y = 0; y < kMaximumMapSizeTechnical; y++)
{
auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y });
auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y });