mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T632, remove invalid callsigns
This commit is contained in:
@@ -308,13 +308,28 @@ namespace BlackSimPlugin
|
|||||||
this->updateOwnParts(parts);
|
this->updateOwnParts(parts);
|
||||||
this->requestRemoteAircraftDataFromXPlane();
|
this->requestRemoteAircraftDataFromXPlane();
|
||||||
|
|
||||||
|
CCallsignSet invalid;
|
||||||
for (CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
for (CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
||||||
{
|
{
|
||||||
// Update remote aircraft to have the latest transponder modes, codes etc.
|
// Update remote aircraft to have the latest transponder modes, codes etc.
|
||||||
const CSimulatedAircraft simulatedAircraft = this->getAircraftInRangeForCallsign(xplaneAircraft.getCallsign());
|
const CCallsign cs = xplaneAircraft.getCallsign();
|
||||||
if (!simulatedAircraft.hasCallsign()) { continue; } // removed in provider
|
const CSimulatedAircraft simulatedAircraft = this->getAircraftInRangeForCallsign(cs);
|
||||||
|
if (!simulatedAircraft.hasCallsign())
|
||||||
|
{
|
||||||
|
// removed in provider
|
||||||
|
if (!cs.isEmpty()) { invalid.insert(cs); }
|
||||||
|
continue;
|
||||||
|
}
|
||||||
xplaneAircraft.setSimulatedAircraft(simulatedAircraft);
|
xplaneAircraft.setSimulatedAircraft(simulatedAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// remove the invalid ones
|
||||||
|
for (const CCallsign &cs : invalid)
|
||||||
|
{
|
||||||
|
this->triggerRemoveAircraft(cs, ++i * 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,17 +671,20 @@ namespace BlackSimPlugin
|
|||||||
aircraft.setRendered(false);
|
aircraft.setRendered(false);
|
||||||
emit this->aircraftRenderingChanged(aircraft);
|
emit this->aircraftRenderingChanged(aircraft);
|
||||||
}
|
}
|
||||||
else if (m_addingInProgressAircraft.contains(callsign))
|
}
|
||||||
|
|
||||||
|
// if adding in progress, postpone
|
||||||
|
if (m_addingInProgressAircraft.contains(callsign))
|
||||||
|
{
|
||||||
|
// we are just about to add that aircraft
|
||||||
|
QPointer<CSimulatorXPlane> myself(this);
|
||||||
|
QTimer::singleShot(TimeoutAdding, this, [ = ]
|
||||||
{
|
{
|
||||||
// we are just about to add that aircraft
|
if (!myself) { return; }
|
||||||
QPointer<CSimulatorXPlane> myself(this);
|
m_addingInProgressAircraft.remove(callsign); // remove as "in progress"
|
||||||
QTimer::singleShot(TimeoutAdding, this, [ = ]
|
this->physicallyRemoveRemoteAircraft(callsign); // and remove from sim. if it was added in the mean time
|
||||||
{
|
});
|
||||||
if (!myself) { return; }
|
return false; // do nothing right now
|
||||||
m_addingInProgressAircraft.remove(callsign); // remove as "in progress"
|
|
||||||
this->physicallyRemoveRemoteAircraft(callsign); // and remove from sim. if it was added in the mean time
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_trafficProxy->removePlane(callsign.asString());
|
m_trafficProxy->removePlane(callsign.asString());
|
||||||
@@ -805,6 +823,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
int aircraftNumber = 0;
|
int aircraftNumber = 0;
|
||||||
const bool updateAllAircraft = this->isUpdateAllRemoteAircraft(currentTimestamp);
|
const bool updateAllAircraft = this->isUpdateAllRemoteAircraft(currentTimestamp);
|
||||||
|
const CCallsignSet callsignsInRange = this->getAircraftInRangeCallsigns();
|
||||||
for (const CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
for (const CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
|
||||||
{
|
{
|
||||||
const CCallsign callsign(xplaneAircraft.getCallsign());
|
const CCallsign callsign(xplaneAircraft.getCallsign());
|
||||||
@@ -816,6 +835,9 @@ namespace BlackSimPlugin
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip no longer in range
|
||||||
|
if (!callsignsInRange.contains(callsign)) { continue; }
|
||||||
|
|
||||||
planesTransponders.callsigns.push_back(callsign.asString());
|
planesTransponders.callsigns.push_back(callsign.asString());
|
||||||
planesTransponders.codes.push_back(xplaneAircraft.getAircraft().getTransponderCode());
|
planesTransponders.codes.push_back(xplaneAircraft.getAircraft().getTransponderCode());
|
||||||
CTransponder::TransponderMode transponderMode = xplaneAircraft.getAircraft().getTransponderMode();
|
CTransponder::TransponderMode transponderMode = xplaneAircraft.getAircraft().getTransponderMode();
|
||||||
@@ -1242,7 +1264,7 @@ namespace BlackSimPlugin
|
|||||||
bool result = service.isValid() && traffic.isValid() && weather.isValid();
|
bool result = service.isValid() && traffic.isValid() && weather.isValid();
|
||||||
if (! result) { return; }
|
if (! result) { return; }
|
||||||
|
|
||||||
QString swiftVersion = BlackConfig::CBuildConfig::getVersionString();
|
QString swiftVersion = CBuildConfig::getVersionString();
|
||||||
QString xswiftbusVersion = service.getVersionNumber();
|
QString xswiftbusVersion = service.getVersionNumber();
|
||||||
if (xswiftbusVersion.isEmpty())
|
if (xswiftbusVersion.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user