mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T285, allow to re-init all aircraft
* aircraft will be removed, then added again as new * this will go thru the full cycle and matching
This commit is contained in:
@@ -340,6 +340,14 @@ namespace BlackCore
|
||||
QObject::disconnect(this);
|
||||
}
|
||||
|
||||
int CAirspaceMonitor::reInitializeAllAircraft()
|
||||
{
|
||||
const CSimulatedAircraftList aircraft = this->getAircraftInRange();
|
||||
CRemoteAircraftProvider::removeAllAircraft();
|
||||
this->asyncAddNewAircraftInRange(aircraft, true);
|
||||
return aircraft.size();
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::onRealNameReplyReceived(const CCallsign &callsign, const QString &realname)
|
||||
{
|
||||
if (!this->isConnected() || realname.isEmpty()) { return; }
|
||||
@@ -756,6 +764,25 @@ namespace BlackCore
|
||||
return CRemoteAircraftProvider::addNewAircraftInRange(newAircraft);
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::asyncAddNewAircraftInRange(const CSimulatedAircraftList &aircraft, bool readyForModelMatching)
|
||||
{
|
||||
if (aircraft.isEmpty()) { return; }
|
||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||
|
||||
int c = 1;
|
||||
QPointer<CAirspaceMonitor> myself(this);
|
||||
for (const CSimulatedAircraft &ac : aircraft)
|
||||
{
|
||||
QTimer::singleShot(c * 25, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
myself->addNewAircraftInRange(ac);
|
||||
if (!readyForModelMatching) { return; }
|
||||
myself->sendReadyForModelMatching(ac.getCallsign());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
int CAirspaceMonitor::updateOnlineStation(const CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues, bool sendSignal)
|
||||
{
|
||||
const int c = m_atcStationsOnline.applyIfCallsign(callsign, vm, skipEqualValues);
|
||||
|
||||
Reference in New Issue
Block a user