From eda0a75fb859ae061c31d3580db5812421e69574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:43:02 +0300 Subject: [PATCH] Code style changes --- src/openrct2/entity/EntityRegistry.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index 37db189881..10cf957f78 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -46,26 +46,27 @@ static std::vector _freeIdList; static bool _entityFlashingList[MAX_ENTITIES]; -constexpr const uint32_t SPATIAL_INDEX_SIZE = (kMaximumMapSizeTechnical * kMaximumMapSizeTechnical) + 1; -constexpr uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1; +static constexpr const uint32_t kSpatialIndexSize = (kMaximumMapSizeTechnical * kMaximumMapSizeTechnical) + 1; +static constexpr uint32_t kSpatialIndexNullBucket = kSpatialIndexSize - 1; + static constexpr uint32_t kInvalidSpatialIndex = 0xFFFFFFFFu; static constexpr uint32_t kSpatialIndexDirtyMask = 1u << 31; -static std::array, SPATIAL_INDEX_SIZE> gEntitySpatialIndex; +static std::array, kSpatialIndexSize> gEntitySpatialIndex; static void FreeEntity(EntityBase& entity); static constexpr uint32_t ComputeSpatialIndex(const CoordsXY& loc) { if (loc.IsNull()) - return SPATIAL_INDEX_LOCATION_NULL; + return kSpatialIndexNullBucket; // NOTE: The input coordinate is rotated and can have negative components. const auto tileX = std::abs(loc.x) / kCoordsXYStep; const auto tileY = std::abs(loc.y) / kCoordsXYStep; if (tileX >= kMaximumMapSizeTechnical || tileY >= kMaximumMapSizeTechnical) - return SPATIAL_INDEX_LOCATION_NULL; + return kSpatialIndexNullBucket; return tileX * kMaximumMapSizeTechnical + tileY; }