refs #852 Add a time offset to CAircraftParts.

This commit is contained in:
Mathew Sutcliffe
2017-01-09 01:42:17 +00:00
parent 4d30ce40c7
commit 3e70ab1207
2 changed files with 22 additions and 1 deletions

View File

@@ -1227,11 +1227,21 @@ namespace BlackCore
BLACK_VERIFY_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
if (callsign.isEmpty()) { return; }
// get time offset from situation
qint64 timeOffsetMs = 6000; //! \fixme 6000 is assumed default offset, copied from CNetworkVatlib::onPilotPositionUpdate
{
QReadLocker lock(&m_lockSituations);
const CAircraftSituationList &situationList = this->m_situationsByCallsign[callsign];
if (!situationList.isEmpty()) { timeOffsetMs = situationList[0].getTimeOffsetMs(); }
}
// list sorted from new to old
QWriteLocker lock(&m_lockParts);
CAircraftPartsList &partsList = this->m_partsByCallsign[callsign];
partsList.push_frontMaxElements(parts, MaxPartsPerCallsign);
partsList.front().setTimeOffsetMs(timeOffsetMs);
if (!m_aircraftSupportingParts.contains(callsign))
{
m_aircraftSupportingParts.push_back(callsign); // mark as callsign which supports parts