a.menuentry = menutext;
a.callback_code = code;
- //atcmentrylist_station[station.c_str()].push_back(a);
(available_dialog[type])[station.c_str()].push_back(a);
}
void FGATCDialog::remove_entry( const string &station, const string &trans, atc_type type ) {
- atcmentry_vec_type atcmlist = (available_dialog[type])[station];
- atcmentry_vec_iterator current = atcmlist.begin();
- atcmentry_vec_iterator last = atcmlist.end();
-
- while(current != last) {
- if(current->transmission == trans) current = atcmlist.erase(current);
+ atcmentry_vec_type* p = &((available_dialog[type])[station]);
+ atcmentry_vec_iterator current = p->begin();
+ while(current != p->end()) {
+ if(current->transmission == trans) current = p->erase(current);
else ++current;
}
}
void FGATCDialog::remove_entry( const string &station, int code, atc_type type ) {
- atcmentry_vec_type atcmlist = (available_dialog[type])[station];
- atcmentry_vec_iterator current = atcmlist.begin();
- atcmentry_vec_iterator last = atcmlist.end();
-
- while(current != last) {
- if(current->callback_code == code) current = atcmlist.erase(current);
+ atcmentry_vec_type* p = &((available_dialog[type])[station]);
+ atcmentry_vec_iterator current = p->begin();
+ while(current != p->end()) {
+ if(current->callback_code == code) current = p->erase(current);
else ++current;
}
}
// query the database whether the transmission is already registered;
bool FGATCDialog::trans_reg( const string &station, const string &trans, atc_type type ) {
- //atcmentry_list_type atcmlist = atcmentrylist_station[station];
- atcmentry_vec_type atcmlist = (available_dialog[type])[station];
- atcmentry_vec_iterator current = atcmlist.begin();
- atcmentry_vec_iterator last = atcmlist.end();
-
- for ( ; current != last ; ++current ) {
+ atcmentry_vec_type* p = &((available_dialog[type])[station]);
+ atcmentry_vec_iterator current = p->begin();
+ for ( ; current != p->end() ; ++current ) {
if ( current->transmission == trans ) return true;
}
return false;
// query the database whether the transmission is already registered;
bool FGATCDialog::trans_reg( const string &station, int code, atc_type type ) {
- //atcmentry_list_type atcmlist = atcmentrylist_station[station];
- atcmentry_vec_type atcmlist = (available_dialog[type])[station];
- atcmentry_vec_iterator current = atcmlist.begin();
- atcmentry_vec_iterator last = atcmlist.end();
-
- for ( ; current != last ; ++current ) {
+ atcmentry_vec_type* p = &((available_dialog[type])[station]);
+ atcmentry_vec_iterator current = p->begin();
+ for ( ; current != p->end() ; ++current ) {
if ( current->callback_code == code ) return true;
}
return false;
}
optList[k] = NULL;
atcDialogCommunicationOptions->newList(optList);
- atcDialogCommunicationOptions->setSize(w-100, h-100);
+ atcDialogCommunicationOptions->setSize(w-100, h-90);
atcDialogCommunicationOptions->reveal();
atcDialogMessage -> setLabel( "ATC Menu" );
atcDialogMessage -> setPosition(w / 2, h - 30);
break;
}
} else if(atcptr->GetType() == TOWER) {
- ATCMenuEntry a = ((available_dialog[TOWER])[(string)atcptr->get_ident()])[atcDialogCommunicationOptions->getValue()];
- atcptr->SetFreqInUse();
- globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code));
- _callbackPending = true;
- _callbackTimer = 0.0;
- _callbackWait = 5.0;
- _callbackPtr = atcptr;
- _callbackCode = a.callback_code;
+ //cout << "TOWER " << endl;
+ //cout << "ident is " << atcptr->get_ident() << endl;
+ atcmentry_vec_type atcmlist = (available_dialog[TOWER])[atcptr->get_ident()];
+ if(atcmlist.size()) {
+ //cout << "Doing callback...\n";
+ ATCMenuEntry a = atcmlist[atcDialogCommunicationOptions->getValue()];
+ atcptr->SetFreqInUse();
+ // This is the user's speech getting displayed.
+ globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code));
+ _callbackPending = true;
+ _callbackTimer = 0.0;
+ _callbackWait = 5.0;
+ _callbackPtr = atcptr;
+ _callbackCode = a.callback_code;
+ } else {
+ //cout << "No options available...\n";
+ }
+ //cout << "Donded" << endl;
}
}
}
FGAirport a;
if ( dclFindAirportID( ident, &a ) ) {
comm_list_type stations;
- int found = current_commlist->FindByPos(a.longitude, a.latitude, a.elevation, 20.0, &stations);
+ int found = current_commlist->FindByPos(a.getLongitude(), a.getLatitude(), a.getElevation(), 20.0, &stations);
if(found) {
ostringstream ostr;
comm_list_iterator itr = stations.begin();