double CommStation::freqMHz() const
{
- return mFreqKhz / 100.0;
+ return mFreqKhz / 1000.0;
}
CommStation*
return;
}
- int n = 0;
for (unsigned int c=0; c < comms.size(); ++c) {
flightgear::CommStation* comm = comms[c];
// add frequency line (modified copy of <group-template>)
- SGPropertyNode *entry = freq_group->getNode("group", n, true);
+ SGPropertyNode *entry = freq_group->getNode("group", c, true);
copyProperties(freq_group->getNode("group-template", true), entry);
entry->removeChildren("enabled", true);
entry->setStringValue("text[0]/label", comm->ident());
-
+
char buf[8];
snprintf(buf, 8, "%.2f", comm->freqMHz());
if(buf[5] == '3') buf[5] = '2';
buf[7] = '\0';
entry->setStringValue("text[1]/label", buf);
- ++n;
}
_gui->showDialog(dialog_name);
switch (lineId) {
case 50:
ty = FGPositioned::FREQ_AWOS;
- if (token[2] == "ATIS") {
+ for( size_t i = 2; i < token.size(); ++i )
+ {
+ if( token[i] == "ATIS" )
+ {
ty = FGPositioned::FREQ_ATIS;
+ break;
+ }
}
break;
case 55:
case 56: ty = FGPositioned::FREQ_APP_DEP; break;
default:
- throw sg_range_exception("unupported apt.dat comm station type");
+ throw sg_range_exception("unsupported apt.dat comm station type");
}
- cache->insertCommStation(ty, token[2], pos, freqKhz, rangeNm, currentAirportID);
+ // Name can contain white spaces. All tokens after the second token are
+ // part of the name.
+ std::string name = token[2];
+ for( size_t i = 3; i < token.size(); ++i )
+ name += ' ' + token[i];
+
+ cache->insertCommStation(ty, name, pos, freqKhz, rangeNm, currentAirportID);
}
else SG_LOG( SG_GENERAL, SG_DEBUG, "Found unnamed comm. Skipping: " << lineId);
}
int range = sqlite3_column_int(loadCommStation, 0);
int freqKhz = sqlite3_column_int(loadCommStation, 1);
- CommStation* c = new CommStation(rowId, id, ty, pos, freqKhz, range);
+ CommStation* c = new CommStation(rowId, name, ty, pos, freqKhz, range);
c->setAirport(airport);
return c;
}