| 380 | } |
| 381 | |
| 382 | void EntityRegistry::EntitySpatialRemove(EntityBase& entity) |
| 383 | { |
| 384 | const auto currentIndex = GetSpatialIndex(entity); |
| 385 | |
| 386 | auto& spatialVector = gEntitySpatialIndex[currentIndex]; |
| 387 | auto index = Algorithm::binaryFind(std::begin(spatialVector), std::end(spatialVector), entity.id); |
| 388 | if (index != std::end(spatialVector)) |
| 389 | { |
| 390 | spatialVector.erase(index, index + 1); |
| 391 | } |
| 392 | else |
| 393 | { |
| 394 | LOG_WARNING("Bad sprite spatial index. Rebuilding the spatial index..."); |
| 395 | ResetEntitySpatialIndices(); |
| 396 | } |
| 397 | |
| 398 | entity.spatialIndex = kInvalidSpatialIndex; |
| 399 | } |
| 400 | |
| 401 | void EntityRegistry::UpdateEntitySpatialIndex(EntityBase& entity) |
| 402 | { |
nothing calls this directly
no test coverage detected