mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T268, moved changeRemoteAircraftModel/Enabled to CSimulatorCommon and removed duplicated code
This commit is contained in:
@@ -135,6 +135,7 @@ namespace BlackCore
|
||||
void CSimulatorCommon::blinkHighlightedAircraft()
|
||||
{
|
||||
if (m_highlightedAircraft.isEmpty() || m_highlightEndTimeMsEpoch < 1) { return; }
|
||||
if (this->isShuttingDown()) { return; }
|
||||
m_blinkCycle = !m_blinkCycle;
|
||||
|
||||
if (QDateTime::currentMSecsSinceEpoch() > m_highlightEndTimeMsEpoch)
|
||||
@@ -404,9 +405,30 @@ namespace BlackCore
|
||||
return r;
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
return aircraft.isEnabled() ?
|
||||
this->physicallyAddRemoteAircraft(aircraft) :
|
||||
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
// we expect the new model "in aircraft"
|
||||
// remove upfront, and then enable / disable again
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
const CCallsign callsign = aircraft.getCallsign();
|
||||
if (!this->isPhysicallyRenderedAircraft(callsign)) { return false; }
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
return this->changeRemoteAircraftEnabled(aircraft);
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
|
||||
{
|
||||
if (this->isMyIdentifier(originator)) { return false; }
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
|
||||
if (commandLine.isEmpty()) { return false; }
|
||||
CSimpleCommandParser parser({ ".plugin", ".drv", ".driver" });
|
||||
parser.parse(commandLine);
|
||||
|
||||
@@ -84,6 +84,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Aviation::CCallsignSet renderedDisabledAircraft() const override;
|
||||
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||
virtual int physicallyRemoveAllRemoteAircraft() override;
|
||||
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
|
||||
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
|
||||
virtual void clearAllRemoteAircraftData() override;
|
||||
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user