bool Route::directTo(const char* const name) { bool ok = false; Basic::PairStream* steerpoints = getComponents(); if (steerpoints != nullptr && name != nullptr) { // When we have steerpoints (components) and a name of a steerpoint Basic::Pair* sp = findSteerpoint(name); if (sp != nullptr) { to = sp; stptIdx = steerpoints->getIndex(sp); ok = true; } } else if (name == nullptr) { to = nullptr; stptIdx = 0; ok = true; } if (steerpoints != nullptr) { steerpoints->unref(); steerpoints = nullptr; } return ok; }
//------------------------------------------------------------------------------ // directTo() -- Change to this steerpoint //------------------------------------------------------------------------------ bool Route::directTo(const Steerpoint* const stpt) { bool ok = false; Basic::PairStream* steerpoints = getComponents(); if (steerpoints != nullptr && stpt != nullptr) { // When we have steerpoints (components) and a steerpoint to switch to ... Basic::Pair* sp = findSteerpoint(stpt); if (sp != nullptr) { to = sp; stptIdx = steerpoints->getIndex(sp); ok = true; } } else if (stpt == nullptr) { to = nullptr; stptIdx = 0; ok = true; } if (steerpoints != nullptr) { steerpoints->unref(); steerpoints = nullptr; } return ok; }