void FGATCMgr::init() {
//cout << "ATCMgr::init called..." << endl;
- comm_node[0] = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
- comm_node[1] = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
+ comm_node[0] = fgGetNode("/instrumentation/comm[0]/frequencies/selected-mhz", true);
+ comm_node[1] = fgGetNode("/instrumentation/comm[1]/frequencies/selected-mhz", true);
lon_node = fgGetNode("/position/longitude-deg", true);
lat_node = fgGetNode("/position/latitude-deg", true);
elev_node = fgGetNode("/position/altitude-ft", true);
voiceOK = v1->LoadVoice("default");
voice = true;
- /* I've loaded the voice even if /sim/sound/audible is false
+ /* I've loaded the voice even if /sim/sound/pause is true
* since I know no way of forcing load of the voice if the user
- * subsequently switches /sim/sound/audible to true. */
+ * subsequently switches /sim/sound/audible to true.
+ * (which is the right thing to do -- CLO) :-) */
#else
voice = false;
#endif
//cout << "ident = " << ident << '\n';
AirportATC *a = new AirportATC;
// I'm not entirely sure that this AirportATC structure business is actually needed - it just duplicates what we can find out anyway!
- a->lon = ap.longitude;
- a->lat = ap.latitude;
- a->elev = ap.elevation;
+ a->lon = ap.getLongitude();
+ a->lat = ap.getLatitude();
+ a->elev = ap.getElevation();
a->atis_freq = GetFrequency(ident, ATIS);
//cout << "ATIS freq = " << a->atis_freq << '\n';
a->atis_active = false;
a->numAI = 1;
airport_atc_map[ident] = a;
return(true);
+ } else {
+ SG_LOG(SG_ATC, SG_ALERT, "ERROR - can't find airport " << ident << " in AIRegisterAirport(...)");
}
}
return(false);
// Channel is zero based
bool FGATCMgr::CommRegisterAirport(string ident, int chan, atc_type tp) {
SG_LOG(SG_ATC, SG_BULK, "Comm channel " << chan << " registered airport " << ident);
- //cout << "Comm channel " << chan << " registered airport " << ident << '\n';
+ //cout << "Comm channel " << chan << " registered airport " << ident << ' ' << tp << '\n';
if(airport_atc_map.find(ident) != airport_atc_map.end()) {
//cout << "IN MAP - flagging set by comm..." << endl;
airport_atc_map[ident]->set_by_comm[chan][tp] = true;
if(dclFindAirportID(ident, &ap)) {
AirportATC *a = new AirportATC;
// I'm not entirely sure that this AirportATC structure business is actually needed - it just duplicates what we can find out anyway!
- a->lon = ap.longitude;
- a->lat = ap.latitude;
- a->elev = ap.elevation;
+ a->lon = ap.getLongitude();
+ a->lat = ap.getLatitude();
+ a->elev = ap.getElevation();
a->atis_freq = GetFrequency(ident, ATIS);
a->atis_active = false;
a->tower_freq = GetFrequency(ident, TOWER);
// TODO - some airports will have a tower/ground frequency but be inactive overnight.
a->set_by_AI = false;
a->numAI = 0;
- a->set_by_comm[chan][tp] = true;
+ a->set_by_comm[chan][tp] = true;
airport_atc_map[ident] = a;
return(true);
}
}
break;
}
- airport_atc_map[id] = a;
+ //airport_atc_map[id] = a;
return;
} else {
switch(chan) {
while(it != atc_list.end()) {
//cout << "type = " << (*it)->GetType() << '\n';
//cout << "Ident = " << (*it)->get_ident() << '\n';
- if( (!strcmp((*it)->get_ident(), id.c_str()))
+ if( ((*it)->get_ident() == id)
&& ((*it)->GetType() == tp) ) {
//Before removing it stop it transmitting!!
//cout << "OBLITERATING FROM LIST!!!\n";
//cout << "Entering FindInList for " << id << ' ' << tp << endl;
atc_list_iterator it = atc_list.begin();
while(it != atc_list.end()) {
- if( (!strcmp((*it)->get_ident(), id.c_str()))
- && ((*it)->GetType() == tp) ) {
+ if( ((*it)->get_ident() == id)
+ && ((*it)->GetType() == tp) ) {
return(*it);
}
++it;
//cout << "Unable to find " << icao << ' ' << type << " in the airport_atc_map" << endl;
return NULL;
}
- //cout << "Found " << icao << ' ' << type << endl;
+ //cout << "In GetATCPointer, found " << icao << ' ' << type << endl;
AirportATC *a = airport_atc_map[icao];
//cout << "a->lon = " << a->lon << '\n';
//cout << "a->elev = " << a->elev << '\n';
case TOWER:
if(a->tower_active) {
// Get the pointer from the list
- return(FindInList(icao.c_str(), type));
+ return(FindInList(icao, type));
} else {
ATCData data;
if(current_commlist->FindByFreq(a->lon, a->lat, a->elev, a->tower_freq, &data, TOWER)) {
atc_list.push_back(t);
a->tower_active = true;
airport_atc_map[icao] = a;
- //cout << "Initing tower in GetATCPointer()\n";
+ //cout << "Initing tower " << icao << " in GetATCPointer()\n";
t->Init();
return(t);
} else {
//cout << "IN CASE GROUND" << endl;
if(a->ground_active) {
// Get the pointer from the list
- return(FindInList(icao.c_str(), type));
+ return(FindInList(icao, type));
} else {
ATCData data;
if(current_commlist->FindByFreq(a->lon, a->lat, a->elev, a->ground_freq, &data, GROUND)) {
for(app_itr = approaches.begin(); app_itr != approaches.end(); app_itr++) {
- FGATC* app = FindInList((app_itr->ident).c_str(), app_itr->type);
+ FGATC* app = FindInList(app_itr->ident, app_itr->type);
if(app != NULL) {
// The station is already in the ATC list
//cout << "In list adding player\n";