mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +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
@@ -137,7 +137,7 @@ namespace BlackSimPlugin
|
||||
return connect;
|
||||
}
|
||||
|
||||
bool CSimulatorFsx::addRemoteAircraft(const Simulation::CSimulatedAircraft &newRemoteAircraft)
|
||||
bool CSimulatorFsx::physicallyAddRemoteAircraft(const Simulation::CSimulatedAircraft &newRemoteAircraft)
|
||||
{
|
||||
CCallsign callsign = newRemoteAircraft.getCallsign();
|
||||
Q_ASSERT(!callsign.isEmpty());
|
||||
@@ -147,7 +147,7 @@ namespace BlackSimPlugin
|
||||
if (aircraftAlreadyExistsInSim)
|
||||
{
|
||||
// remove first
|
||||
this->removeRemoteAircraft(callsign);
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
CLogMessage(this).warning("Have to remove aircraft %1 before I can add it") << callsign;
|
||||
}
|
||||
|
||||
@@ -294,11 +294,16 @@ namespace BlackSimPlugin
|
||||
this->displayStatusMessage(message.asStatusMessage(true, true));
|
||||
}
|
||||
|
||||
bool CSimulatorFsx::isRenderedAircraft(const CCallsign &callsign) const
|
||||
bool CSimulatorFsx::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||
{
|
||||
return this->m_simConnectObjects.contains(callsign);
|
||||
}
|
||||
|
||||
CCallsignSet CSimulatorFsx::physicallyRenderedAircraft() const
|
||||
{
|
||||
return this->m_simConnectObjects.keys();
|
||||
}
|
||||
|
||||
void CSimulatorFsx::onSimRunning()
|
||||
{
|
||||
if (m_simRunning) { return; }
|
||||
@@ -511,23 +516,23 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
bool CSimulatorFsx::removeRemoteAircraft(const CCallsign &callsign)
|
||||
bool CSimulatorFsx::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||
{
|
||||
// only remove from sim
|
||||
if (!m_simConnectObjects.contains(callsign)) { return false; }
|
||||
return removeRemoteAircraft(m_simConnectObjects.value(callsign));
|
||||
return physicallyRemoveRemoteAircraft(m_simConnectObjects.value(callsign));
|
||||
}
|
||||
|
||||
void CSimulatorFsx::removeAllRemoteAircraft()
|
||||
void CSimulatorFsx::physicallyRemoveAllRemoteAircraft()
|
||||
{
|
||||
QList<CCallsign> callsigns(m_simConnectObjects.keys());
|
||||
for (const CCallsign &cs : callsigns)
|
||||
{
|
||||
removeRemoteAircraft(cs);
|
||||
physicallyRemoveRemoteAircraft(cs);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSimulatorFsx::removeRemoteAircraft(const CSimConnectObject &simObject)
|
||||
bool CSimulatorFsx::physicallyRemoveRemoteAircraft(const CSimConnectObject &simObject)
|
||||
{
|
||||
CCallsign callsign(simObject.getCallsign());
|
||||
m_simConnectObjects.remove(callsign);
|
||||
|
||||
@@ -103,14 +103,14 @@ 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::remoteRenderedAircraft()
|
||||
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::updateOwnCockpit
|
||||
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator) override;
|
||||
@@ -121,8 +121,11 @@ 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;
|
||||
//! \copydoc ISimulator::isPhysicallyRenderedAircraft
|
||||
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc ISimulator::physicallyRenderedAircraft
|
||||
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
||||
|
||||
//! Called when sim has started
|
||||
void onSimRunning();
|
||||
@@ -159,7 +162,7 @@ namespace BlackSimPlugin
|
||||
|
||||
private:
|
||||
//! Remove a remote aircraft
|
||||
bool removeRemoteAircraft(const CSimConnectObject &simObject);
|
||||
bool physicallyRemoveRemoteAircraft(const CSimConnectObject &simObject);
|
||||
|
||||
//! Init when connected
|
||||
HRESULT initWhenConnected();
|
||||
|
||||
Reference in New Issue
Block a user