if an entity has no simulatorID, pull it out of list of entities with simulatorIDs

This commit is contained in:
Seth Alves 2015-04-17 11:12:13 -07:00
parent 32ced31f60
commit d90dec066c

View file

@ -38,10 +38,11 @@ void SimpleEntitySimulation::updateEntitiesInternal(const quint64& now) {
itemItr = _hasSimulationOwnerEntities.begin();
while (itemItr != _hasSimulationOwnerEntities.end()) {
EntityItem* entity = *itemItr;
if (!entity->getSimulatorID().isNull() &&
usecTimestampNow() - entity->getLastChangedOnServer() >= AUTO_REMOVE_SIMULATION_OWNER_USEC) {
if (entity->getSimulatorID().isNull()) {
itemItr = _hasSimulationOwnerEntities.erase(itemItr);
} else if (usecTimestampNow() - entity->getLastChangedOnServer() >= AUTO_REMOVE_SIMULATION_OWNER_USEC) {
qCDebug(entities) << "auto-removing simulation owner" << entity->getSimulatorID();
entity->setSimulatorID("");
entity->setSimulatorID(QUuid());
itemItr = _hasSimulationOwnerEntities.erase(itemItr);
} else {
++itemItr;