void TeamSensorSystem::addSensor(SensorSystemPtr sensor) { if(numSensors == MAX_SENSORS_PER_TEAM) Fatal(0, " TeamSensorSystem.addSensor: too many sensors "); sensor->setMasterIndex(numSensors); sensors[numSensors++] = sensor; }
void TeamSensorSystem::removeSensor (SensorSystemPtr sensor) { sensor->clearContacts(); long index = sensor->getMasterIndex(); sensor->setMasterIndex(-1); sensors[index] = NULL; if (index < (numSensors - 1)) { sensors[index] = sensors[numSensors - 1]; sensors[index]->setMasterIndex(index); sensors[numSensors - 1] = NULL; } numSensors--; }
void TeamSensorSystem::removeSensor(SensorSystemPtr sensor) { sensor->clearContacts(); int32_t index = sensor->getMasterIndex(); sensor->setMasterIndex(-1); sensors[index] = nullptr; if(index < (numSensors - 1)) { sensors[index] = sensors[numSensors - 1]; sensors[index]->setMasterIndex(index); sensors[numSensors - 1] = nullptr; } numSensors--; }