| 218 | } |
| 219 | |
| 220 | void moveSpatialEntry(EntityBase& entity, const World::Pos3& loc) |
| 221 | { |
| 222 | const auto newIndex = getSpatialIndexOffset(loc); |
| 223 | const auto oldIndex = getSpatialIndexOffset(entity.position); |
| 224 | if (newIndex != oldIndex) |
| 225 | { |
| 226 | if (!removeFromSpatialIndex(entity, oldIndex)) |
| 227 | { |
| 228 | Logging::info("Invalid quadrant ids... Resetting spatial index."); |
| 229 | resetSpatialIndex(); |
| 230 | moveSpatialEntry(entity, loc); |
| 231 | return; |
| 232 | } |
| 233 | insertToSpatialIndex(entity, newIndex); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | static void zeroEntity(EntityBase* ent); |
| 238 |
no test coverage detected