MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / moveSpatialEntry

Function moveSpatialEntry

src/OpenLoco/src/Entities/EntityManager.cpp:220–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

moveToMethod · 0.85

Calls 5

getSpatialIndexOffsetFunction · 0.85
removeFromSpatialIndexFunction · 0.85
infoFunction · 0.85
resetSpatialIndexFunction · 0.85
insertToSpatialIndexFunction · 0.85

Tested by

no test coverage detected