]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AILocalTraffic.cxx
Catch sound exceptions at the earliest, report problem has an alert, and continue...
[flightgear.git] / src / ATC / AILocalTraffic.cxx
index fe716d9043b9c7acfb758a068d72266e31a6572e..29dda83d328078b59c772c0fce58f9c9d54635ea 100644 (file)
@@ -61,7 +61,6 @@ FGAILocalTraffic::FGAILocalTraffic() {
                                          globals->get_sim_time_sec() );
        *//*
        _model = model;
-       _model->ref();
        _aip.init(_model);
        */
        //SetModel(model);
@@ -125,10 +124,9 @@ FGAILocalTraffic::FGAILocalTraffic() {
 }
 
 FGAILocalTraffic::~FGAILocalTraffic() {
-       //_model->deRef();
 }
 
-void FGAILocalTraffic::GetAirportDetails(string id) {
+void FGAILocalTraffic::GetAirportDetails(const string& id) {
        AirportATC a;
        if(ATC->GetAirportATCDetails(airportID, &a)) {
                if(a.tower_freq) {      // Has a tower - TODO - check the opening hours!!!
@@ -156,7 +154,7 @@ void FGAILocalTraffic::GetAirportDetails(string id) {
                _controlled = false;
        }
        // Get the airport elevation
-       aptElev = dclGetAirportElev(airportID.c_str());
+       aptElev = fgGetAirportElev(airportID.c_str());
        //cout << "Airport elev in AILocalTraffic = " << aptElev << '\n';
        // WARNING - we use this elev for the whole airport - some assumptions in the code 
        // might fall down with very slopey airports.
@@ -164,7 +162,7 @@ void FGAILocalTraffic::GetAirportDetails(string id) {
 
 // Get details of the active runway
 // It is assumed that by the time this is called the tower control and airport code will have been set up.
-void FGAILocalTraffic::GetRwyDetails(string id) {
+void FGAILocalTraffic::GetRwyDetails(const string& id) {
        //cout << "GetRwyDetails called" << endl;
        
        if(_controlled) {
@@ -226,7 +224,7 @@ To a certain extent it's FGAIMgr that has to worry about this, but we need to pr
 sufficient initialisation functionality within the plane classes to allow the manager
 to initially position them where and how required.
 */
-bool FGAILocalTraffic::Init(const string& callsign, string ICAO, OperatingState initialState, PatternLeg initialLeg) {
+bool FGAILocalTraffic::Init(const string& callsign, const string& ICAO, OperatingState initialState, PatternLeg initialLeg) {
        //cout << "FGAILocalTraffic.Init(...) called" << endl;
        airportID = ICAO;
        
@@ -1069,8 +1067,8 @@ void FGAILocalTraffic::FlyTrafficPattern(double dt) {
                if(descending) {
                        if(orthopos.y() < -50.0) {
                                double thesh_offset = 30.0;
-                               slope = atan((_pos.elev() - dclGetAirportElev(airportID)) / (orthopos.y() - thesh_offset)) * DCL_RADIANS_TO_DEGREES;
-                               //cout << "slope = " << slope << ", elev = " << _pos.elev() << ", apt_elev = " << dclGetAirportElev(airportID) << ", op.y = " << orthopos.y() << '\n';
+                               slope = atan((_pos.elev() - fgGetAirportElev(airportID)) / (orthopos.y() - thesh_offset)) * DCL_RADIANS_TO_DEGREES;
+                               //cout << "slope = " << slope << ", elev = " << _pos.elev() << ", apt_elev = " << fgGetAirportElev(airportID) << ", op.y = " << orthopos.y() << '\n';
                                if(slope < -10.0) slope = -10.0;
                                _savedSlope = slope;
                                _pitch = -4.0;
@@ -1314,7 +1312,7 @@ void FGAILocalTraffic::ProcessCallback(int code) {
        }
 }
 
-void FGAILocalTraffic::ExitRunway(Point3D orthopos) {
+void FGAILocalTraffic::ExitRunway(const Point3D& orthopos) {
        //cout << "In ExitRunway" << endl;
        //cout << "Runway ID is " << rwy.ID << endl;