]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATCmgr.cxx
any wind < 1kt is "calm", not just 0.0
[flightgear.git] / src / ATC / ATCmgr.cxx
index 6aa95a547c2ae743bb89d352422a048420280bf2..bbf99dfa620f2965f2796213d4b67ddbca58e6ff 100644 (file)
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
 
 #include "ATCmgr.hxx"
 #include "commlist.hxx"
-#include "ATCdisplay.hxx"
 #include "ATCDialog.hxx"
 #include "ATCutils.hxx"
+#include "transmissionlist.hxx"
+#include "ground.hxx"
+
 
 /*
 // periodic radio station search wrapper
@@ -106,16 +112,20 @@ void FGATCMgr::init() {
     SGPath p_comm( globals->get_fg_root() );
     current_commlist->init( p_comm );
        
-       // Set the user callsign - bit of a hack at the moment - eventually should be read from aircraft file and user-over-rideable
-       fgSetString("/sim/user/callsign", "Golf Foxtrot Sierra");       // C-FGFS
-
 #ifdef ENABLE_AUDIO_SUPPORT    
        // Load all available voices.
        // For now we'll do one hardwired one
        
        v1 = new FGATCVoice;
-       voiceOK = v1->LoadVoice("default");
-       voice = true;
+       try {
+               voiceOK = v1->LoadVoice("default");
+               voice = true;
+       } catch ( sg_io_exception & ) {
+               voiceOK  = false;
+               voice = false;
+               delete v1;
+               v1 = 0;
+       }
        
        /* 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
@@ -216,14 +226,14 @@ bool FGATCMgr::AIRegisterAirport(const string& ident) {
                airport_atc_map[ident]->numAI++;
                return(true);
        } else {
-               FGAirport ap;
-               if(dclFindAirportID(ident, &ap)) {
+               const FGAirport *ap = fgFindAirportID(ident);
+               if (ap) {
                        //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.getLongitude();
-                       a->lat = ap.getLatitude();
-                       a->elev = ap.getElevation();
+                       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;
@@ -266,13 +276,13 @@ bool FGATCMgr::CommRegisterAirport(const string& ident, int chan, const atc_type
                return(true);
        } else {
                //cout << "NOT IN MAP - creating new..." << endl;
-               FGAirport ap;
-               if(dclFindAirportID(ident, &ap)) {
+               const FGAirport *ap = fgFindAirportID(ident);
+               if (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.getLongitude();
-                       a->lat = ap.getLatitude();
-                       a->elev = ap.getElevation();
+                       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);