mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 07:05:38 +08:00
Ref T632, in snapshot avoid to add aircraft which are no longer in range
This commit is contained in:
@@ -679,7 +679,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void ISimulator::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
void ISimulator::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||||
{
|
{
|
||||||
if (!snapshot.isValidSnapshot()) { return;}
|
if (!snapshot.isValidSnapshot()) { return; }
|
||||||
|
|
||||||
// for unrestricted values all add/remove actions are directly linked
|
// for unrestricted values all add/remove actions are directly linked
|
||||||
// when changing back from restricted->unrestricted an one time update is required
|
// when changing back from restricted->unrestricted an one time update is required
|
||||||
@@ -692,9 +692,12 @@ namespace BlackCore
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (snapshot.isRenderingEnabled())
|
if (snapshot.isRenderingEnabled())
|
||||||
{
|
{
|
||||||
|
// make sure not to add aircraft again which are no longer in range
|
||||||
|
const CCallsignSet callsignsInRange = this->getAircraftInRangeCallsigns();
|
||||||
|
const CCallsignSet callsignsEnabledAndStillInRange = snapshot.getEnabledAircraftCallsignsByDistance().intersection(callsignsInRange);
|
||||||
const CCallsignSet callsignsInSimulator(this->physicallyRenderedAircraft()); // state in simulator
|
const CCallsignSet callsignsInSimulator(this->physicallyRenderedAircraft()); // state in simulator
|
||||||
const CCallsignSet callsignsToBeRemoved(callsignsInSimulator.difference(snapshot.getEnabledAircraftCallsignsByDistance()));
|
const CCallsignSet callsignsToBeRemoved(callsignsInSimulator.difference(callsignsEnabledAndStillInRange));
|
||||||
const CCallsignSet callsignsToBeAdded(snapshot.getEnabledAircraftCallsignsByDistance().difference(callsignsInSimulator));
|
const CCallsignSet callsignsToBeAdded(callsignsEnabledAndStillInRange.difference(callsignsInSimulator));
|
||||||
if (!callsignsToBeRemoved.isEmpty())
|
if (!callsignsToBeRemoved.isEmpty())
|
||||||
{
|
{
|
||||||
const int r = this->physicallyRemoveMultipleRemoteAircraft(callsignsToBeRemoved);
|
const int r = this->physicallyRemoveMultipleRemoteAircraft(callsignsToBeRemoved);
|
||||||
|
|||||||
Reference in New Issue
Block a user