]> git.mxchange.org Git - flightgear.git/commitdiff
Fix a situation where the AI aircraft sometimes wouldn't be visible when they should
authordaveluff <daveluff>
Fri, 12 Mar 2004 15:58:00 +0000 (15:58 +0000)
committerdaveluff <daveluff>
Fri, 12 Mar 2004 15:58:00 +0000 (15:58 +0000)
src/ATC/AILocalTraffic.cxx
src/ATC/AILocalTraffic.hxx

index cfbe1ca6b528afb7102bbbf6cb3f1f0d795b36dd..78fb59a1b34c5cc28f2a836a24fbd15f1c9a1192 100644 (file)
@@ -119,6 +119,8 @@ FGAILocalTraffic::FGAILocalTraffic() {
        _savedSlope = 0.0;
        
        _controlled = false;
+       
+       _invisible = false;
 }
 
 FGAILocalTraffic::~FGAILocalTraffic() {
@@ -468,6 +470,16 @@ void FGAILocalTraffic::FlyCircuits(int numCircuits, bool tag) {
 // Run the internal calculations
 void FGAILocalTraffic::Update(double dt) {
        //cout << "U" << flush;
+       
+       // we shouldn't really need this since there's a LOD of 10K on the whole plane anyway I think.
+       // At the moment though I need to to avoid DList overflows - the whole plane LOD obviously isn't getting picked up.
+       if(!_invisible) {
+               if(dclGetHorizontalSeparation(_pos, Point3D(fgGetDouble("/position/longitude-deg"), fgGetDouble("/position/latitude-deg"), 0.0)) > 8000) _aip.setVisible(false);
+               else _aip.setVisible(true);
+       } else {
+               _aip.setVisible(false);
+       }
+       
        //double responseTime = 10.0;           // seconds - this should get more sophisticated at some point
        responseCounter += dt;
        if((contactTower) && (responseCounter >= 8.0)) {
@@ -1360,9 +1372,10 @@ void FGAILocalTraffic::ExitRunway(Point3D orthopos) {
        } else {
                // Something must have gone wrong with the ground network file - or there is only a rwy here and no exits defined
                SG_LOG(SG_ATC, SG_INFO, "No exits found by FGAILocalTraffic from runway " << rwy.rwyID << " at " << airportID << '\n');
-               //cout << "No exits found by " << plane.callsign << " from runway " << rwy.rwyID << " at " << airportID << '\n';
+               //if(airportID == "KRHV") cout << "No exits found by " << plane.callsign << " from runway " << rwy.rwyID << " at " << airportID << '\n';
                // What shall we do - just remove the plane from sight?
                _aip.setVisible(false);
+               _invisible = true;
                //cout << "Setting visible false\n";
                //tower->ReportRunwayVacated(plane.callsign);
                string trns = "Clear of the runway ";
index 690ebd2e7cf4c429f43427e9d5fc9ed4cfdc019e..c5562b227af5b0fcca637aa27bcd457dbd606416 100644 (file)
@@ -223,6 +223,9 @@ private:
        void GetNextTaxiNode();
        
        void DoGroundElev();
+       
+       // Set when the plane should be invisible *regardless of distance from user*.
+       bool _invisible;
 };
 
 #endif  // _FG_AILocalTraffic_HXX