]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATCDialog.cxx
Catch sound exceptions at the earliest, report problem has an alert, and continue...
[flightgear.git] / src / ATC / ATCDialog.cxx
index b54679d5cdb1a6ea3755b0c3c6582bcc5466986d..b2b6964cdcbdd15f39f568103e11011dc6fa4354 100644 (file)
@@ -264,12 +264,15 @@ void FGATCDialog::PopupCallback(int num) {
                //cout << "TOWER " << endl;
                //cout << "ident is " << atcptr->get_ident() << endl;
                atcmentry_vec_type atcmlist = (available_dialog[TOWER])[atcptr->get_ident()];
-               if(atcmlist.size()) {
+               unsigned int size = atcmlist.size();
+               if(size && num < size) {
                        //cout << "Doing callback...\n";
                        ATCMenuEntry a = atcmlist[num];
                        atcptr->SetFreqInUse();
+                       string pilot = atcptr->GenText(a.transmission, a.callback_code);
+                       fgSetString("/sim/messages/pilot", pilot.c_str());
                        // This is the user's speech getting displayed.
-                       globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code));
+                       globals->get_ATC_display()->RegisterSingleMessage(pilot);
                        _callbackPending = true;
                        _callbackTimer = 0.0;
                        _callbackWait = 5.0;