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

Function removeFromSpatialIndex

src/OpenLoco/src/Entities/EntityManager.cpp:192–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190 }
191
192 static bool removeFromSpatialIndex(EntityBase& entity, const size_t index)
193 {
194 auto* quadId = &_entitySpatialIndex[index];
195 _entitySpatialCount = 0;
196 while (enumValue(*quadId) < Limits::kMaxEntities)
197 {
198 auto* quadEnt = get<EntityBase>(*quadId);
199 if (quadEnt == &entity)
200 {
201 *quadId = entity.nextQuadrantId;
202 return true;
203 }
204 _entitySpatialCount++;
205 if (_entitySpatialCount > Limits::kMaxEntities)
206 {
207 break;
208 }
209 quadId = &quadEnt->nextQuadrantId;
210 }
211 return false;
212 }
213
214 static bool removeFromSpatialIndex(EntityBase& entity)
215 {

Callers 2

moveSpatialEntryFunction · 0.85
freeEntityFunction · 0.85

Calls 2

enumValueFunction · 0.85
getSpatialIndexOffsetFunction · 0.85

Tested by

no test coverage detected