//------------------------------------------------------------------------------ // 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(); } }