| 130 | } |
| 131 | |
| 132 | constexpr size_t getSpatialIndexOffset(const World::Pos2& loc) |
| 133 | { |
| 134 | if (loc.x == Location::null) |
| 135 | { |
| 136 | return kEntitySpatialIndexNull; |
| 137 | } |
| 138 | |
| 139 | const auto tileX = std::abs(loc.x) / World::kTileSize; |
| 140 | const auto tileY = std::abs(loc.y) / World::kTileSize; |
| 141 | |
| 142 | if (tileX >= World::kMapPitch || tileY >= World::kMapPitch) |
| 143 | { |
| 144 | return kEntitySpatialIndexNull; |
| 145 | } |
| 146 | |
| 147 | return (World::kMapPitch * tileX) + tileY; |
| 148 | } |
| 149 | |
| 150 | EntityId firstQuadrantId(const World::Pos2& loc) |
| 151 | { |
no outgoing calls
no test coverage detected