Load APT1000 comm frequencies correctly.
See discussion in: https://sourceforge.net/p/flightgear/codetickets/2336/
This commit is contained in:
parent
5b3cdb49c5
commit
94ff2f8ee4
1 changed files with 31 additions and 22 deletions
|
@ -258,6 +258,11 @@ const FGAirport* APTLoader::loadAirportFromFile(std::string id, const SGPath& ap
|
|||
return loadAirport(aptdb_file.c_str(), id, &rawInfo, true);
|
||||
}
|
||||
|
||||
static bool isCommLine(const int code)
|
||||
{
|
||||
return ((code >= 50) && (code <= 56)) || ((code >= 1050) && (code <= 1056));
|
||||
}
|
||||
|
||||
const FGAirport* APTLoader::loadAirport(const string aptDat, const std::string airportID, RawAirportInfo* airport_info, bool createFGAirport)
|
||||
{
|
||||
// The first line for this airport was already split over whitespace, but
|
||||
|
@ -300,7 +305,7 @@ const FGAirport* APTLoader::loadAirport(const string aptDat, const std::string a
|
|||
// custom startup locations (ignore)
|
||||
} else if ( rowCode == 0 ) {
|
||||
// ??
|
||||
} else if ( rowCode >= 50 && rowCode <= 56) {
|
||||
} else if (isCommLine(rowCode)) {
|
||||
parseCommLine(aptDat, linesIt->number, rowCode,
|
||||
simgear::strutils::split(linesIt->str));
|
||||
} else if (rowCode == 110) {
|
||||
|
@ -339,8 +344,7 @@ const FGAirport* APTLoader::loadAirport(const string aptDat, const std::string a
|
|||
} else {
|
||||
std::ostringstream oss;
|
||||
string cleanedLine = cleanLine(linesIt->str);
|
||||
oss << aptDat << ":" << linesIt->number << ": unknown row code " <<
|
||||
rowCode;
|
||||
oss << aptDat << ":" << linesIt->number << ": unknown row code " << rowCode;
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, oss.str() << " (" << cleanedLine << ")");
|
||||
throw sg_format_exception(oss.str(), cleanedLine);
|
||||
}
|
||||
|
@ -814,8 +818,13 @@ void APTLoader::parseCommLine(const string& aptDat,
|
|||
rwy_lat_accum / (double)rwy_count,
|
||||
last_apt_elev);
|
||||
|
||||
// short int representing tens of kHz:
|
||||
int freqKhz = atoi(token[1].c_str()) * 10;
|
||||
const bool isAPT1000Code = rowCode > 1000;
|
||||
if (isAPT1000Code) {
|
||||
rowCode -= 1000;
|
||||
}
|
||||
// short int representing tens of kHz, or just kHz directly
|
||||
int freqKhz = std::stoi(token[1]) * (isAPT1000Code ? 1 : 10);
|
||||
|
||||
int rangeNm = 50;
|
||||
FGPositioned::Type ty;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue