// Get the next free bomb of type 'bombType' Bomb* SimpleStoresMgr::getSpecificBomb(const Basic::String* const bombType) { Bomb* bomb = 0; if (bombType != 0) { Basic::PairStream* list = getWeapons(); if (list != 0) { // Find the first free (inactive) bomb Basic::List::Item* item = list->getFirstItem(); while (item != 0 && bomb == 0) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Bomb* p = dynamic_cast<Bomb*>( pair->object() ); if (p != 0 && p->isInactive()) { // Ok, we have a bomb, but is it the type we want? if (*p->getType() == *bombType) { p->ref(); bomb = p; } } item = item->getNext(); } list->unref(); } } return bomb; }
// Default external equipment jettison event handler bool Stores::onJettisonEvent(ExternalStore* const sys) { bool ok = false; if (sys != 0) { Basic::PairStream* list = getStores(); if (list != 0) { // First, make sure it's one of ours! bool found = false; Basic::List::Item* item = list->getFirstItem(); while (item != 0 && !found) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); found = (sys == pair->object()); // is it a match? item = item->getNext(); } if (found) { // Send a jettison event to the system ok = sys->event(JETTISON_EVENT); } list->unref(); list = 0; } } return ok; }
// Get the next free weapon of this 'type' Weapon* SimpleStoresMgr::getSpecificWeapon(const std::type_info& type) { Weapon* wpn = 0; if (&type != 0) { Basic::PairStream* list = getWeapons(); if (list != 0) { // Find the first free (inactive) bomb Basic::List::Item* item = list->getFirstItem(); while (item != 0 && wpn == 0) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Weapon* p = dynamic_cast<Weapon*>( pair->object() ); if (p != 0 && p->isInactive() && p->isClassType(type)) { p->ref(); wpn = p; } item = item->getNext(); } list->unref(); } } return wpn; }
//------------------------------------------------------------------------------ // setSlotReversed() -- //------------------------------------------------------------------------------ bool Field::setSlotReversed(const Basic::Number* const srobj) { if (srobj != 0) { // Set our mode if (srobj->getBoolean()) { setDisplayMode(reversed); setDisplayMode(reversed1); } else { clearDisplayMode(reversed); clearDisplayMode(reversed1); } // Set our children's mode Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { const Basic::List::Item* item = subcomponents->getFirstItem(); while (item != 0) { Basic::Pair* p = (Basic::Pair*) item->getValue(); Field* child = dynamic_cast<Field*>(p->object()); if (child != 0) child->setSlotReversed(srobj); item = item->getNext(); } subcomponents->unref(); subcomponents = 0; } } return true; }
// Get the next free missile of type 'missileType' Missile* SimpleStoresMgr::getSpecificMissile(const Basic::String* const missileType) { Missile* msl = 0; if (missileType != 0) { Basic::PairStream* list = getWeapons(); if (list != 0) { // Find the first free (inactive) missile of type weaponType Basic::List::Item* item = list->getFirstItem(); while (item != 0 && msl == 0) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Missile* p = dynamic_cast<Missile*>( pair->object() ); if (p != 0 && p->isInactive()) { // Ok, we have a missile, but is it the type we want? if (*p->getType() == *missileType) { p->ref(); msl = p; } } item = item->getNext(); } list->unref(); } } return msl; }
//------------------------------------------------------------------------------ // setSlotHighlight() -- //------------------------------------------------------------------------------ bool Field::setSlotHighlight(const Basic::Number* const shobj) { if (shobj != 0) { // Set our mode if (shobj->getBoolean()) { setDisplayMode(highlight); setDisplayMode(highlight1); } else { setDisplayMode(highlight); setDisplayMode(highlight1); } Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { const Basic::List::Item* item = subcomponents->getFirstItem(); while (item != 0) { Basic::Pair* p = (Basic::Pair*) item->getValue(); Field* child = dynamic_cast<Field*>(p->object()); if (child != 0) child->setSlotHighlight(shobj); //changed from obj item = item->getNext(); } subcomponents->unref(); subcomponents = 0; } } return true; }
//------------------------------------------------------------------------------ // stepOwnshipPlayer() -- Step to the next local player //------------------------------------------------------------------------------ void SimStation::stepOwnshipPlayer() { Basic::PairStream* pl = getSimulation()->getPlayers(); if (pl != nullptr) { Simulation::Player* f = nullptr; Simulation::Player* n = nullptr; bool found = false; // Find the next player Basic::List::Item* item = pl->getFirstItem(); while (item != nullptr) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); if (pair != nullptr) { Simulation::Player* ip = static_cast<Simulation::Player*>(pair->object()); if ( ip->isMode(Simulation::Player::ACTIVE) && ip->isLocalPlayer() && ip->isClassType(typeid(Simulation::AirVehicle)) ) { if (f == nullptr) { f = ip; } // Remember the first if (found) { n = ip; ; break; } if (ip == getOwnship()) found = true; } } item = item->getNext(); } if (found && n == nullptr) n = f; if (n != nullptr) setOwnshipPlayer(n); pl->unref(); } }
//------------------------------------------------------------------------------ // updateData() //------------------------------------------------------------------------------ void Instrument::updateData(const LCreal dt) { // update our base class BaseClass::updateData(dt); // check for a color rotary, just in case we need one BasicGL::ColorRotary* cr = dynamic_cast<BasicGL::ColorRotary*>(getColor()); if (cr != 0) cr->determineColor(preScaleInstVal); // only tell the rest of our instruments our value if we want them to know it if (allowPassing) { // sort out the instruments from our components Basic::PairStream* ps = getComponents(); if (ps != 0) { Basic::List::Item* item = ps->getFirstItem(); while(item != 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); if (pair != 0) { // send the value down to all of our instrument components Instrument* myInst = dynamic_cast<Instrument*>(pair->object()); Basic::Number n = preScaleInstVal; if (myInst != 0) myInst->event(UPDATE_INSTRUMENTS, &n); } item = item->getNext(); } ps->unref(); ps = 0; } } }
//------------------------------------------------------------------------------ // Compute nav steering data for each steerpoint. //------------------------------------------------------------------------------ void Route::computeSteerpointData(const LCreal, const Navigation* const nav) { if (nav != nullptr) { Basic::PairStream* steerpoints = getComponents(); if (steerpoints != nullptr) { // Until we pass the 'to' steerpoint, the 'from' pointer will be // null(0) and the steerpoint's compute() function will compute // direct-to the steerpoint. After the 'to' steerpoint, the 'from' // pointer will help compute each from-to leg of the route. Steerpoint* from = nullptr; Basic::List::Item* item = steerpoints->getFirstItem(); while (item != nullptr) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); Steerpoint* stpt = static_cast<Steerpoint*>(pair->object()); stpt->compute(nav,from); if (pair == to || from != nullptr) from = stpt; item = item->getNext(); } steerpoints->unref(); steerpoints = nullptr; } } }
//------------------------------------------------------------------------------ // Set slot functions //------------------------------------------------------------------------------ bool StoresMgr::setSlotStores(const Basic::PairStream* const msg) { // First let our base class do everything that it needs to. BaseClass::setSlotStores(msg); // --- // Clear all previous stores and assigned weapons // --- weaponsList = 0; externalList = 0; fuelList = 0; gunPtr = 0; // --- // Use the stores list that the Stores class just processed. Basic::PairStream* stores = getStores(); if (stores != 0){ // Create the new weapons list that contains all weapons { Basic::PairStream* newWeapons = new Basic::PairStream(); searchAndAdd(stores, typeid(Weapon), newWeapons); if (newWeapons->entries() > 0) weaponsList = newWeapons; newWeapons->unref(); } // Create the new external stores list that contains all // non-weapon, external stores (e.g., fuel tanks, pods, guns) { Basic::PairStream* newExternal = new Basic::PairStream(); searchAndAdd(stores, typeid(ExternalStore), newExternal); if (newExternal->entries() > 0) externalList = newExternal; newExternal->unref(); } // Create the new fuel tank list that contains all fuel tanks { Basic::PairStream* newFuel = new Basic::PairStream(); searchAndAdd(stores, typeid(FuelTank), newFuel); if (newFuel->entries() > 0) fuelList = newFuel; newFuel->unref(); } // Find the primary gun; i.e., the first gun found on our stores Basic::List::Item* item = stores->getFirstItem(); while (item != 0 && gunPtr == 0) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Gun* p = dynamic_cast<Gun*>( pair->object() ); if (p != 0) gunPtr = p; item = item->getNext(); } stores->unref(); stores = 0; } return true; }
//------------------------------------------------------------------------------ // getSteerpoints() -- Get the route we're flying to (starting at 'to') //------------------------------------------------------------------------------ unsigned int Route::getSteerpoints(Basic::safe_ptr<Steerpoint>* const stptList, const unsigned int max) { unsigned int i = 0; Basic::PairStream* steerpoints = getComponents(); if (stptList != nullptr && max > 0 && steerpoints != nullptr) { // Find our 'to' steerpoint bool found = false; Basic::List::Item* item = steerpoints->getFirstItem(); while (item != nullptr && !found) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); found = (pair == to); if (!found) { item = item->getNext(); } } // Get the route we're flying 'to' while (item != nullptr && i < max) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); Steerpoint* p = dynamic_cast<Steerpoint*>(pair->object()); if (p != nullptr) { stptList[i++] = p; } item = item->getNext(); } } if (steerpoints != nullptr) { steerpoints->unref(); steerpoints = nullptr; } return i; }
// Default weapon jettison event handler bool Stores::onJettisonEvent(Weapon* const wpn) { bool ok = false; if (wpn != nullptr) { Basic::PairStream* list = getStores(); if (list != nullptr) { // First, make sure it's one of ours! bool found = false; Basic::List::Item* item = list->getFirstItem(); while (item != nullptr && !found) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); found = (wpn == pair->object()); // is it a match? item = item->getNext(); } if (found) { // Send a jettison event to the weapon ok = wpn->event(JETTISON_EVENT); } list->unref(); list = nullptr; } } return ok; }
//------------------------------------------------------------------------------ // setOwnshipPlayer() -- set this player as our ownship //------------------------------------------------------------------------------ bool Station::setOwnshipPlayer(Player* const newOS) { // Is it already own ownship? Yes, then nothing else to do. if (newOS == ownship) return true; // When we're just setting a null(0) ownship ... if (newOS == 0) { // Unref the old player if (ownshipName != 0) { ownshipName->unref(); ownshipName = 0; } if (ownship != 0) { ownship->event(ON_OWNSHIP_DISCONNECT); ownship->unref(); ownship = 0; } return true; } // Look for this ownship in our list of players bool set = false; Basic::PairStream* pl = sim->getPlayers(); if (pl != 0) { Basic::List::Item* item = pl->getFirstItem(); while (item != 0 && !set) { Basic::Pair* pair = dynamic_cast<Basic::Pair*>(item->getValue()); if (pair != 0) { Player* ip = dynamic_cast<Player*>( pair->object() ); if (ip == newOS && ip->isLocalPlayer()) { // Unref the old stuff if (ownshipName != 0) { ownshipName->unref(); ownshipName = 0; } if (ownship != 0) { ownship->event(ON_OWNSHIP_DISCONNECT); ownship->unref(); ownship = 0; } // Ok, we found the player -- make it our ownship ownship = newOS; ownship->ref(); ownshipName = pair->slot(); ownshipName->ref(); ownship->event(ON_OWNSHIP_CONNECT); set = true; } } item = item->getNext(); } pl->unref(); pl = 0; } return set; }
//------------------------------------------------------------------------------ // killedNotification() -- Default killed notification handler //------------------------------------------------------------------------------ bool System::killedNotification(Player* const p) { // Just let all of our subcomponents know that we were just killed Basic::PairStream* subcomponents = getComponents(); if(subcomponents != 0) { for (Basic::List::Item* item = subcomponents->getFirstItem(); item != 0; item = item->getNext()) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Basic::Component* sc = (Basic::Component*) pair->object(); sc->event(KILL_EVENT, p); } subcomponents->unref(); subcomponents = 0; } return true; }
// DATALINK_MESSAGE event handler bool Datalink::onDatalinkMessageEvent(Basic::Object* const msg) { // Just pass it down to all of our subcomponents Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { for (Basic::List::Item* item = subcomponents->getFirstItem(); item != 0; item = item->getNext()) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); Basic::Component* sc = static_cast<Basic::Component*>(pair->object()); sc->event(DATALINK_MESSAGE, msg); } subcomponents->unref(); subcomponents = 0; } return true; }
//------------------------------------------------------------------------------ // Default function to jettison all jettisonable stores //------------------------------------------------------------------------------ bool Stores::jettisonAll() { // Notify the external stores that we're shutting down Basic::PairStream* list = getStores(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); Basic::Component* p = static_cast<Basic::Component*>( pair->object() ); p->event(JETTISON_EVENT); item = item->getNext(); } list->unref(); list = 0; } return true; }
//------------------------------------------------------------------------------ // updateData() -- update non-time critical stuff here //------------------------------------------------------------------------------ void SimpleStoresMgr::updateData(const LCreal dt) { BaseClass::updateData(dt); // --- // Get the current weapon data // --- { Weapon* wpn = (Weapon*) getCurrentWeapon(); if (wpn != 0) { // Weapon ID curWpnID = wpn->getWeaponID(); // Number of this type weapon int count = 0; Basic::PairStream* list = getStores(); if (list != 0) { const Basic::List::Item* item = list->getFirstItem(); while (item != 0) { const Basic::Pair* pair = (Basic::Pair*) item->getValue(); if (pair != 0) { const Weapon* s = dynamic_cast<const Weapon*>( pair->object() ); if ( s != 0 && s->isMode(Player::INACTIVE) && strcmp(s->getFormName(), wpn->getFormName()) == 0 ) { count++; } } item = item->getNext(); } list->unref(); list = 0; } nCurWpn = count; wpn->unref(); wpn = 0; } else { curWpnID = 0; nCurWpn = 0; } } }
//------------------------------------------------------------------------------ // shutdownNotification() -- We're shutting down //------------------------------------------------------------------------------ bool StoresMgr::shutdownNotification() { // Notify the external stores that we're shutting down Basic::PairStream* list = getStores(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0) { Basic::Pair* pair = (Basic::Pair*)(item->getValue()); Basic::Component* p = (Basic::Component*)( pair->object() ); p->event(SHUTDOWN_EVENT); item = item->getNext(); } list->unref(); list = 0; } // Clear our stores setSlotStores(0); return BaseClass::shutdownNotification(); }
//------------------------------------------------------------------------------ // updateData() -- update non-time critical stuff here //------------------------------------------------------------------------------ void Stores::updateData(const LCreal dt) { // Update our non-weapon, external stores, which need to act as // active systems attached to our ownship player. { Basic::PairStream* list = getStores(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); ExternalStore* p = dynamic_cast<ExternalStore*>( pair->object() ); if (p != 0) p->updateData(dt); item = item->getNext(); } list->unref(); list = 0; } } BaseClass::updateData(dt); }
//------------------------------------------------------------------------------ // setSlotJustification() -- //------------------------------------------------------------------------------ bool Field::setSlotJustification(const Basic::String* const sjobj) { bool ok = true; if (sjobj != 0) { // Set our justification if ( *sjobj == "none" ) justification(Basic::String::NONE); else if ( *sjobj == "left" ) justification(Basic::String::LEFT); else if ( *sjobj == "center" ) justification(Basic::String::CENTER); else if ( *sjobj == "right" ) justification(Basic::String::RIGHT); else { if (isMessageEnabled(MSG_ERROR)) { std::cerr << "Field::setJustification: No proper inputs" << std::endl; } ok = false; } // Set our children's justification Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { const Basic::List::Item* item = subcomponents->getFirstItem(); while (item != 0) { Basic::Pair* p = (Basic::Pair*) item->getValue(); Field* child = dynamic_cast<Field*>(p->object()); if (child != 0) child->setSlotJustification(sjobj); item = item->getNext(); } subcomponents->unref(); subcomponents = 0; } } return ok; }
//------------------------------------------------------------------------------ // getAllSteerpoints() -- Get all of the steerpoints in the route //------------------------------------------------------------------------------ unsigned int Route::getAllSteerpoints(Basic::safe_ptr<Steerpoint>* const stptList, const unsigned int max) { unsigned int i = 0; Basic::PairStream* steerpoints = getComponents(); if (stptList != nullptr && max > 0 && steerpoints != nullptr) { Basic::List::Item* item = steerpoints->getFirstItem(); while (item != nullptr && i < max) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); Steerpoint* p = dynamic_cast<Steerpoint*>(pair->object()); if (p != nullptr) { stptList[i++] = p; } item = item->getNext(); } } if (steerpoints != nullptr) { steerpoints->unref(); steerpoints = nullptr; } return i; }
Missile* SimpleStoresMgr::getNextMissileImp() { Missile* msl = 0; Basic::PairStream* list = getWeapons(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0 && msl == 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); Missile* p = dynamic_cast<Missile*>( pair->object() ); if (p != 0) { if (p->isInactive() || p->isReleaseHold()) { msl = (Missile*) p->getPointer(); } } item = item->getNext(); } list->unref(); } return msl; }
// set our slot values via a pairstream bool ColorRotary::setSlotValues(const Basic::PairStream* const newStream) { bool ok = false; numVals = 0; if (newStream != nullptr) { Basic::PairStream* a = newStream->clone(); Basic::List::Item* item = a->getFirstItem(); while (item != nullptr) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); if (pair != nullptr) { Basic::Number* n = dynamic_cast<Basic::Number*>(pair->object()); if (n != nullptr) { myValues[numVals] = n->getReal(); numVals++; } } item = item->getNext(); } ok = true; a->unref(); } return ok; }
void TableRow::position() { // position the fields in this table item Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { int ln = line(); int cp = column(); Basic::List::Item* item = subcomponents->getFirstItem(); while (item != 0) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); BasicGL::Field* ti = static_cast<BasicGL::Field*>(pair->object()); ti->line(ln); ti->column(cp); cp += static_cast<int>(ti->width()); item = item->getNext(); } subcomponents->unref(); subcomponents = 0; } }
//------------------------------------------------------------------------------ // position() -- position the rows in this table //------------------------------------------------------------------------------ void Table::position() { Basic::PairStream* subcomponents = getComponents(); if (subcomponents != 0) { int ln = line(); int cp = column(); // Position our subcomponents, which are all TableRow objects (see build()) Basic::List::Item* item = subcomponents->getFirstItem(); while (item != 0) { Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue()); TableRow* row = static_cast<TableRow*>(pair->object()); row->line(ln); row->column(cp); ln += spacing; item = item->getNext(); } subcomponents->unref(); subcomponents = 0; } }
Bomb* SimpleStoresMgr::getNextBombImp() { Bomb* bomb = 0; Basic::PairStream* list = getWeapons(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0 && bomb == 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); Bomb* p = dynamic_cast<Bomb*>( pair->object() ); if (p != 0) { if (p->isInactive() || p->isReleaseHold()) { bomb = (Bomb*) p->getPointer(); } } item = item->getNext(); } list->unref(); } return bomb; }
Chaff* SimpleStoresMgr::getNextChaffImp() { Chaff* chaff = 0; Basic::PairStream* list = getWeapons(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0 && chaff == 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); Chaff* p = dynamic_cast<Chaff*>( pair->object() ); if (p != 0) { if (p->isInactive() || p->isReleaseHold()) { chaff = (Chaff*) p->getPointer(); } } item = item->getNext(); } list->unref(); } return chaff; }
Flare* SimpleStoresMgr::getNextFlareImp() { Flare* flare = 0; Basic::PairStream* list = getWeapons(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0 && flare == 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); Flare* p = dynamic_cast<Flare*>( pair->object() ); if (p != 0) { if (p->isInactive() || p->isReleaseHold()) { flare = (Flare*) p->getPointer(); } } item = item->getNext(); } list->unref(); } return flare; }
Decoy* SimpleStoresMgr::getNextDecoyImp() { Decoy* decoy = 0; Basic::PairStream* list = getWeapons(); if (list != 0) { Basic::List::Item* item = list->getFirstItem(); while (item != 0 && decoy == 0) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); Decoy* p = dynamic_cast<Decoy*>( pair->object() ); if (p != 0) { if (p->isInactive() || p->isReleaseHold()) { decoy = (Decoy*) p->getPointer(); } } item = item->getNext(); } list->unref(); } return decoy; }
//------------------------------------------------------------------------------ // insertSteerpoint() - //------------------------------------------------------------------------------ bool Route::insertSteerpoint(Steerpoint* const newStpt, const int pos) { bool ok = false; unsigned int num = getNumberOfSteerpoints(); // make a new character string char numString[10]; // this tells us the number of the next steerpoint to be created in the slot list std::sprintf(numString,"%i",(num+1)); // now we have the slot name, which is the next number in the steerpoint list // now create a new pair, and if we have a component list, add it to it, if // not, then create a new component list Basic::Pair* p = new Basic::Pair(numString, newStpt); if (p != nullptr) { // We're its container newStpt->container(this); // Get our steerpoints Basic::PairStream* steerpoints = getComponents(); // now we have to add it to our component list if (steerpoints != nullptr && num != 0) { // Copy the current steerpoint list Basic::PairStream* tempList = new Basic::PairStream(); { Basic::List::Item* item = steerpoints->getFirstItem(); while (item != nullptr) { Basic::Pair* pair = (Basic::Pair*) item->getValue(); tempList->put(pair); item = item->getNext(); } } if (pos == -1) { tempList->addHead(p); ok = true; } else if (pos == 0 || pos > num) { tempList->addTail(p); ok = true; } else if (pos > 0 && pos <= static_cast<int>(num)) { // count to our position, then insert it int counter = 1; Basic::List::Item* item = tempList->getFirstItem(); while (counter < pos && item != nullptr) { item = item->getNext(); counter++; } // now we should have the reference pair at the 'pos' position if (item != nullptr) { Basic::List::Item* newItem = new Basic::List::Item; newItem->value = p; p->ref(); // insert 'newItem' just before 'item' ok = tempList->insert(newItem, item); } } // swap our current steerpoint (components) list for this new one if (ok) { Basic::Component::processComponents(tempList,typeid(Steerpoint)); } tempList->unref(); tempList = nullptr; } // if we have no components, we need to start a new component list else { Basic::Component::processComponents(nullptr, typeid(Steerpoint), p); ok = true; } // Unref the original steerpoint list if (steerpoints != nullptr) { steerpoints->unref(); steerpoints = nullptr; } p->unref(); // Our component list has it now. } // --- // Call directTo() to reset the steerpoint index, or if we were going nowhere // then go direct-to steerpoint one. // --- if (ok) { if (to != nullptr) { Steerpoint* sp = static_cast<Steerpoint*>(to->object()); directTo(sp); } else { directTo(1); } } return ok; }