Ref T280, using the QHash<CCallsign, T> definitions to unify use cases

This commit is contained in:
Klaus Basan
2018-06-12 00:47:49 +02:00
parent edde558f29
commit c5fb428fa9
8 changed files with 25 additions and 32 deletions

View File

@@ -37,7 +37,7 @@
#include <QJsonObject>
#include <QList>
#include <QMap>
#include <QHash>
#include <QMetaObject>
#include <QObject>
#include <QReadWriteLock>
@@ -167,9 +167,8 @@ namespace BlackCore
BlackMisc::Aviation::CAtcStationList m_atcStationsOnline; //!< online ATC stations
BlackMisc::Aviation::CAtcStationList m_atcStationsBooked; //!< booked ATC stations
QMap<BlackMisc::Aviation::CCallsign, FsInnPacket> m_tempFsInnPackets;
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CFlightPlan> m_flightPlanCache; //!< flight plan information retrieved from network and cached
QHash<BlackMisc::Aviation::CCallsign, FsInnPacket> m_tempFsInnPackets;
QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CFlightPlan> m_flightPlanCache; //!< flight plan information retrieved from network and cached
INetwork *m_network = nullptr; //!< corresponding network interface
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer

View File

@@ -739,9 +739,9 @@ namespace BlackCore
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 (!m_lastSentSituations.contains(compare.getCallsign())) { return false; }
if (compare.isNull()) { return false; }
return compare.equalPbhAndVector(m_lastSentSituation.value(compare.getCallsign()));
return compare.equalPbhAndVector(m_lastSentSituations.value(compare.getCallsign()));
}
bool CSimulatorCommon::isEqualLastSent(const CAircraftParts &compare, const CCallsign &callsign) const
@@ -754,7 +754,7 @@ namespace BlackCore
void CSimulatorCommon::rememberLastSent(const CAircraftSituation &sent)
{
Q_ASSERT_X(sent.hasCallsign(), Q_FUNC_INFO, "Need callsign");
m_lastSentSituation.insert(sent.getCallsign(), sent);
m_lastSentSituations.insert(sent.getCallsign(), sent);
}
void CSimulatorCommon::rememberLastSent(const CAircraftParts &sent, const CCallsign &callsign)
@@ -846,7 +846,7 @@ namespace BlackCore
m_callsignsToBeRendered.clear();
m_clampedLogMsg.clear();
m_lastSentParts.clear();
m_lastSentSituation.clear();
m_lastSentSituations.clear();
m_updateRemoteAircraftInProgress = false;
this->resetHighlighting();
@@ -891,7 +891,7 @@ namespace BlackCore
m_statsPhysicallyRemovedAircraft++;
m_clampedLogMsg.clear();
m_lastSentParts.remove(remoteCallsign);
m_lastSentSituation.remove(remoteCallsign);
m_lastSentSituations.remove(remoteCallsign);
m_clampedLogMsg.remove(remoteCallsign);
this->physicallyRemoveRemoteAircraft(remoteCallsign);
}

View File

@@ -283,9 +283,9 @@ namespace BlackCore
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
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
BlackMisc::Aviation::CTimestampPerCallsign m_clampedLogMsg; //!< when logged last for this callsign, can be used so there is no log message overflow
BlackMisc::Aviation::CAircraftSituationPerCallsign m_lastSentSituations; //!< last situation sent to simulator
BlackMisc::Aviation::CAircraftPartsPerCallsign m_lastSentParts; //!< last parts sent to simulator
// 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