| 45 | using namespace OpenRCT2::Core; |
| 46 | |
| 47 | static constexpr uint32_t ComputeSpatialIndex(const CoordsXY& loc) |
| 48 | { |
| 49 | if (loc.IsNull()) |
| 50 | return kSpatialIndexNullBucket; |
| 51 | |
| 52 | // NOTE: The input coordinate is rotated and can have negative components. |
| 53 | const auto tileX = std::abs(loc.x) / kCoordsXYStep; |
| 54 | const auto tileY = std::abs(loc.y) / kCoordsXYStep; |
| 55 | |
| 56 | if (tileX >= kMaximumMapSizeTechnical || tileY >= kMaximumMapSizeTechnical) |
| 57 | return kSpatialIndexNullBucket; |
| 58 | |
| 59 | return tileX * kMaximumMapSizeTechnical + tileY; |
| 60 | } |
| 61 | |
| 62 | static constexpr uint32_t GetSpatialIndex(EntityBase& entity) |
| 63 | { |
no test coverage detected