MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / EntitySpatialRemove

Method EntitySpatialRemove

src/openrct2/entity/EntityRegistry.cpp:382–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 2

GetSpatialIndexFunction · 0.85
binaryFindFunction · 0.85

Tested by

no test coverage detected