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

Method EntitySpatialInsert

src/openrct2/entity/EntityRegistry.cpp:371–380  ·  view source on GitHub ↗

Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order

Source from the content-addressed store, hash-verified

369
370 // Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order
371 void EntityRegistry::EntitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc)
372 {
373 const auto newIndex = ComputeSpatialIndex(newLoc);
374
375 auto& spatialVector = gEntitySpatialIndex[newIndex];
376
377 Algorithm::sortedInsert(spatialVector, entity.id);
378
379 entity.spatialIndex = newIndex;
380 }
381
382 void EntityRegistry::EntitySpatialRemove(EntityBase& entity)
383 {

Callers

nothing calls this directly

Calls 2

ComputeSpatialIndexFunction · 0.85
sortedInsertFunction · 0.85

Tested by

no test coverage detected