1
0
Fork 0
flightgear/src/ATC/CommStation.cxx
Thomas Geymayer 5ac3de21e3 Fix some CommStation bugs
- kHz/mHz conversion needs factor 1000 not 100
 - Correctly read name for CommStations from NavCache
 - Fix parsing CommStation names from apt.dat (Name
   can contain spaces)
2012-09-27 12:21:22 +02:00

36 lines
807 B
C++

#include "CommStation.hxx"
#include <Navaids/NavDataCache.hxx>
namespace flightgear {
CommStation::CommStation(PositionedID aGuid, const std::string& name, FGPositioned::Type t, const SGGeod& pos, int range, int freq) :
FGPositioned(aGuid, t, name, pos),
mRangeNM(range),
mFreqKhz(freq),
mAirport(0)
{
}
void CommStation::setAirport(PositionedID apt)
{
mAirport = apt;
}
FGAirport* CommStation::airport() const
{
return (FGAirport*) NavDataCache::instance()->loadById(mAirport);
}
double CommStation::freqMHz() const
{
return mFreqKhz / 1000.0;
}
CommStation*
CommStation::findByFreq(int freqKhz, const SGGeod& pos, FGPositioned::Filter* filt)
{
return (CommStation*) NavDataCache::instance()->findCommByFreq(freqKhz, pos, filt).ptr();
}
} // of namespace flightgear