mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T273, Ref T275 compare equal parts/situation functions
This commit is contained in:
@@ -650,6 +650,33 @@ namespace BlackCore
|
|||||||
m_statsLastUpdateAircraftRequested = startTime;
|
m_statsLastUpdateAircraftRequested = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSimulatorCommon::isEqualLastSent(const CAircraftSituation &compare) const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(compare.hasCallsign(), Q_FUNC_INFO, "Need callsign");
|
||||||
|
if (!m_lastSentSituation.contains(compare.getCallsign())) { return false; }
|
||||||
|
if (compare.isNull()) { return false; }
|
||||||
|
return compare.equalPbhAndVector(m_lastSentSituation.value(compare.getCallsign()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSimulatorCommon::isEqualLastSent(const CAircraftParts &compare, const CCallsign &callsign) const
|
||||||
|
{
|
||||||
|
if (callsign.isEmpty()) { return false; }
|
||||||
|
if (!m_lastSentParts.contains(callsign)) { return false; }
|
||||||
|
return compare.equalValues(m_lastSentParts.value(callsign));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimulatorCommon::rememberLastSent(const CAircraftSituation &sent)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(sent.hasCallsign(), Q_FUNC_INFO, "Need callsign");
|
||||||
|
m_lastSentSituation.insert(sent.getCallsign(), sent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimulatorCommon::rememberLastSent(const CAircraftParts &sent, const CCallsign &callsign)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||||
|
m_lastSentParts.insert(callsign, sent);
|
||||||
|
}
|
||||||
|
|
||||||
void CSimulatorCommon::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
void CSimulatorCommon::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||||
{
|
{
|
||||||
if (!snapshot.isValidSnapshot()) { return;}
|
if (!snapshot.isValidSnapshot()) { return;}
|
||||||
@@ -732,6 +759,8 @@ namespace BlackCore
|
|||||||
m_addAgainAircraftWhenRemoved.clear();
|
m_addAgainAircraftWhenRemoved.clear();
|
||||||
m_callsignsToBeRendered.clear();
|
m_callsignsToBeRendered.clear();
|
||||||
m_clampedLogMsg.clear();
|
m_clampedLogMsg.clear();
|
||||||
|
m_lastSentParts.clear();
|
||||||
|
m_lastSentSituation.clear();
|
||||||
m_updateRemoteAircraftInProgress = false;
|
m_updateRemoteAircraftInProgress = false;
|
||||||
|
|
||||||
this->resetHighlighting();
|
this->resetHighlighting();
|
||||||
@@ -772,6 +801,9 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
m_statsPhysicallyRemovedAircraft++;
|
m_statsPhysicallyRemovedAircraft++;
|
||||||
m_clampedLogMsg.clear();
|
m_clampedLogMsg.clear();
|
||||||
|
m_lastSentParts.remove(remoteCallsign);
|
||||||
|
m_lastSentSituation.remove(remoteCallsign);
|
||||||
|
m_clampedLogMsg.remove(remoteCallsign);
|
||||||
this->physicallyRemoveRemoteAircraft(remoteCallsign);
|
this->physicallyRemoveRemoteAircraft(remoteCallsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
#include "blackcore/aircraftmatcher.h"
|
#include "blackcore/aircraftmatcher.h"
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
@@ -103,6 +104,13 @@ namespace BlackCore
|
|||||||
//! @}
|
//! @}
|
||||||
//! \copydoc ISimulator::parseCommandLine
|
//! \copydoc ISimulator::parseCommandLine
|
||||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||||
|
|
||||||
|
//! \name Interface implementations, called from context
|
||||||
|
//! @{
|
||||||
|
virtual bool logicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) override;
|
||||||
|
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
|
//! @}
|
||||||
|
|
||||||
// --------- ISimulator implementations ------------
|
// --------- ISimulator implementations ------------
|
||||||
|
|
||||||
//! Register help
|
//! Register help
|
||||||
@@ -142,12 +150,6 @@ namespace BlackCore
|
|||||||
BlackMisc::Network::IClientProvider *clientProvider,
|
BlackMisc::Network::IClientProvider *clientProvider,
|
||||||
QObject *parent);
|
QObject *parent);
|
||||||
|
|
||||||
//! \name Interface implementations, called from context
|
|
||||||
//! @{
|
|
||||||
virtual bool logicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft) override;
|
|
||||||
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
//! \name When swift DB data are read
|
//! \name When swift DB data are read
|
||||||
//! @{
|
//! @{
|
||||||
virtual void onSwiftDbAllDataRead();
|
virtual void onSwiftDbAllDataRead();
|
||||||
@@ -235,6 +237,18 @@ namespace BlackCore
|
|||||||
//! Update stats and flags
|
//! Update stats and flags
|
||||||
void setStatsRemoteAircraftUpdate(qint64 startTime);
|
void setStatsRemoteAircraftUpdate(qint64 startTime);
|
||||||
|
|
||||||
|
//! Equal to last sent situation
|
||||||
|
bool isEqualLastSent(const BlackMisc::Aviation::CAircraftSituation &compare) const;
|
||||||
|
|
||||||
|
//! Equal to last sent situation
|
||||||
|
bool isEqualLastSent(const BlackMisc::Aviation::CAircraftParts &compare, const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||||
|
|
||||||
|
//! Remember as last sent
|
||||||
|
void rememberLastSent(const BlackMisc::Aviation::CAircraftSituation &sent);
|
||||||
|
|
||||||
|
//! Remember as last sent
|
||||||
|
void rememberLastSent(const BlackMisc::Aviation::CAircraftParts &sent, const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Lookup against DB data
|
//! Lookup against DB data
|
||||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|
||||||
@@ -250,7 +264,9 @@ namespace BlackCore
|
|||||||
|
|
||||||
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
|
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
|
||||||
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
||||||
QMap<BlackMisc::Aviation::CCallsign, qint64> m_clampedLogMsg; //!< when logged last so there, can be used so there is no log message overflow
|
QMap<BlackMisc::Aviation::CCallsign, qint64> m_clampedLogMsg; //!< when logged last for this callsign, can be used so there is no log message overflow
|
||||||
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituation> m_lastSentSituation; //!< last situation sent to simulator
|
||||||
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftParts> m_lastSentParts; //!< last parts sent to simulator
|
||||||
|
|
||||||
// some optional functionality which can be used by the simulators as needed
|
// some optional functionality which can be used by the simulators as needed
|
||||||
BlackMisc::Simulation::CSimulatedAircraftList m_addAgainAircraftWhenRemoved; //!< add this model again when removed, normally used to change model
|
BlackMisc::Simulation::CSimulatedAircraftList m_addAgainAircraftWhenRemoved; //!< add this model again when removed, normally used to change model
|
||||||
|
|||||||
Reference in New Issue
Block a user