refs #398, asserts for frequency

the line
if (frequencyKHz < 100000) { frequencyKHz += 100000; }
might be removed after the fix
This commit is contained in:
Klaus Basan
2015-03-28 00:45:20 +01:00
parent 8163ad2762
commit f95504a2c8
2 changed files with 5 additions and 1 deletions

View File

@@ -611,6 +611,7 @@ namespace BlackCore
void CAirspaceMonitor::ps_atcPositionUpdate(const CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range)
{
Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this));
Q_ASSERT(CComSystem::isValidCivilAviationFrequency(frequency));
if (!this->m_connected) { return; }
CAtcStationList stationsWithCallsign = this->m_atcStationsOnline.findByCallsign(callsign);
if (stationsWithCallsign.isEmpty())

View File

@@ -745,8 +745,11 @@ namespace BlackCore
void CNetworkVatlib::onAtcPositionUpdate(VatSessionID, const char *callsign, const VatAtcPosition *pos, void *cbvar)
{
CFrequency freq(pos->frequency, CFrequencyUnit::kHz());
int frequencyKHz = pos->frequency;
if (frequencyKHz < 100000) { frequencyKHz += 100000; }
CFrequency freq(frequencyKHz, CFrequencyUnit::kHz());
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
Q_ASSERT(CComSystem::isValidCivilAviationFrequency(freq));
emit cbvar_cast(cbvar)->atcPositionUpdate(cbvar_cast(cbvar)->fromFSD(callsign), freq,
CCoordinateGeodetic(pos->latitude, pos->longitude, 0), CLength(pos->visibleRange, CLengthUnit::NM()));
}