mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
refs #395, prepared for logical / physical add/remote member functions
* renamed functions * added access to snapshot * moved simulator base class in own files (.h/.cpp)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
91f0b99cc5
commit
e9f7810efc
@@ -93,13 +93,13 @@ namespace BlackSimPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::addRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
||||
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
||||
{
|
||||
CCallsign callsign = newRemoteAircraft.getCallsign();
|
||||
if (m_hashFs9Clients.contains(callsign))
|
||||
{
|
||||
// already exists, remove first
|
||||
this->removeRemoteAircraft(callsign);
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
}
|
||||
|
||||
CFs9Client *client = new CFs9Client(m_interpolator, this, callsign.toQString(), CTime(25, CTimeUnit::ms()));
|
||||
@@ -113,7 +113,7 @@ namespace BlackSimPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::removeRemoteAircraft(const CCallsign &callsign)
|
||||
bool CSimulatorFs9::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||
{
|
||||
if (!m_hashFs9Clients.contains(callsign)) { return false; }
|
||||
|
||||
@@ -125,15 +125,20 @@ namespace BlackSimPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatorFs9::removeAllRemoteAircraft()
|
||||
void CSimulatorFs9::physicallyRemoveAllRemoteAircraft()
|
||||
{
|
||||
QList<CCallsign> callsigns(this->m_hashFs9Clients.keys());
|
||||
for (const CCallsign &cs : callsigns)
|
||||
{
|
||||
removeRemoteAircraft(cs);
|
||||
physicallyRemoveRemoteAircraft(cs);
|
||||
}
|
||||
}
|
||||
|
||||
CCallsignSet CSimulatorFs9::physicallyRenderedAircraft() const
|
||||
{
|
||||
return this->m_hashFs9Clients.keys();
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::updateOwnSimulatorCockpit(const CAircraft &ownAircraft, const QString &originator)
|
||||
{
|
||||
if (originator == this->simulatorOriginator()) { return false; }
|
||||
@@ -200,7 +205,7 @@ namespace BlackSimPlugin
|
||||
this->displayStatusMessage(message.asStatusMessage(true, true));
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::isRenderedAircraft(const CCallsign &callsign) const
|
||||
bool CSimulatorFs9::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||
{
|
||||
return m_hashFs9Clients.contains(callsign);
|
||||
}
|
||||
@@ -273,7 +278,7 @@ namespace BlackSimPlugin
|
||||
// Stop all FS9 client tasks
|
||||
for (auto fs9Client : m_hashFs9Clients.keys())
|
||||
{
|
||||
removeRemoteAircraft(fs9Client);
|
||||
physicallyRemoveRemoteAircraft(fs9Client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,20 @@ namespace BlackSimPlugin
|
||||
//! \copydoc ISimulator::disconnectFrom()
|
||||
virtual bool disconnectFrom() override;
|
||||
|
||||
//! \copydoc ISimulator::addRemoteAircraft()
|
||||
virtual bool addRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
|
||||
//! \copydoc ISimulator::physicallyAddRemoteAircraft()
|
||||
virtual bool physicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
|
||||
|
||||
//! \copydoc ISimulator::removeRemoteAircraft()
|
||||
virtual bool removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
//! \copydoc ISimulator::physicallyRemoveRemoteAircraft()
|
||||
virtual bool physicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulator::removeAllRemoteAircraft
|
||||
virtual void removeAllRemoteAircraft() override;
|
||||
//! \copydoc BlackCore::ISimulator::physicallyRemoveAllRemoteAircraft
|
||||
virtual void physicallyRemoveAllRemoteAircraft() override;
|
||||
|
||||
//! \copydoc ISimulator::physicallyRenderedAircraft
|
||||
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
||||
|
||||
//! \copydoc ISimulator::isPhysicallyRenderedAircraft
|
||||
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc ISimulator::updateOwnSimulatorCockpit()
|
||||
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator) override;
|
||||
@@ -84,9 +90,6 @@ namespace BlackSimPlugin
|
||||
//! \copydoc ISimulator::displayTextMessage()
|
||||
virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const override;
|
||||
|
||||
//! \copydoc ISimulator::isRenderedAircraft
|
||||
virtual bool isRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
protected:
|
||||
//! Timer event
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user