]> git.mxchange.org Git - flightgear.git/commitdiff
Make FGRunway track reciprocal runways.
authorjmt <jmt>
Wed, 16 Sep 2009 00:17:12 +0000 (00:17 +0000)
committerTim Moore <timoore@redhat.com>
Thu, 17 Sep 2009 20:51:44 +0000 (22:51 +0200)
src/Airports/apt_loader.cxx
src/Airports/runways.cxx
src/Airports/runways.hxx

index a8af8ca4792d50e720006081f2985762173b31e1..320a5715012b7ee6cf4d81828e9299f511c84150 100644 (file)
@@ -286,6 +286,9 @@ private:
                 displ_thresh2, stopway2, surface_code, true);
 
       runways.push_back(reciprocal);
+      
+      rwy->setReciprocalRunway(reciprocal);
+      reciprocal->setReciprocalRunway(rwy);
     }
   }
 
@@ -335,6 +338,9 @@ private:
               pos, heading_2, length, width, 
               displ_thresh2, stopway2, surface_code, true);
     runways.push_back(reciprocal);
+    
+    rwy->setReciprocalRunway(reciprocal);
+    reciprocal->setReciprocalRunway(rwy);
   }
 
   void parseWaterRunwayLine850(const vector<string>& token)
@@ -373,6 +379,9 @@ private:
               pos, heading_2, length, width, 
               0.0, 0.0, 13, true);
     runways.push_back(reciprocal);
+    
+    rwy->setReciprocalRunway(reciprocal);
+    reciprocal->setReciprocalRunway(rwy);
   }
 
   void parseHelipadLine850(const vector<string>& token)
index f97cd14e83aee82c4c4dde7e078d2a77362ba50d..c076d8cfc1ff0f44d5f3233742256abab563ca01 100644 (file)
@@ -71,7 +71,8 @@ FGRunway::FGRunway(FGAirport* aAirport, const string& aIdent,
                         bool reciprocal) :
   FGRunwayBase(RUNWAY, cleanRunwayNo(aIdent), aGeod, heading, length, width, surface_code, true),
   _airport(aAirport),
-  _reciprocal(reciprocal),
+  _isReciprocal(reciprocal),
+  _reciprocal(NULL),
   _displ_thresh(displ_thresh),
   _stopway(stopway),
   _ils(NULL)
@@ -158,3 +159,12 @@ void FGRunway::processThreshold(SGPropertyNode* aThreshold)
   SGGeodesy::direct(newThreshold, _heading, offsetFt * SG_FEET_TO_METER, newCenter, dummy);
   mPosition = newCenter;
 } 
+
+void FGRunway::setReciprocalRunway(FGRunway* other)
+{
+  assert(_reciprocal==NULL);
+  assert((other->_reciprocal == NULL) || (other->_reciprocal == this));
+  
+  _reciprocal = other;
+}
+
index 15d39c2af9fcd0eec6e6a4f9eafeffc6f1ab4787..e6f97ea95d7790c30898fbcd6e4ec9c7a5bc865d 100644 (file)
@@ -36,7 +36,8 @@ class SGPropertyNode;
 class FGRunway : public FGRunwayBase
 {
   FGAirport* _airport;
-  bool _reciprocal;
+  bool _isReciprocal;
+  FGRunway* _reciprocal;
   double _displ_thresh;
   double _stopway;
   FGNavRecord* _ils;
@@ -68,7 +69,7 @@ public:
    * over runways to avoid counting runways twice, if desired.
    */
   bool isReciprocal() const
-  { return _reciprocal; }
+  { return _isReciprocal; }
 
   /**
    * Get the runway begining point - this is syntatic sugar, equivalent to
@@ -106,6 +107,10 @@ public:
   FGNavRecord* ILS() const { return _ils; }
   void setILS(FGNavRecord* nav) { _ils = nav; }
   
+  FGRunway* reciprocalRunway() const
+  { return _reciprocal; }
+  void setReciprocalRunway(FGRunway* other);
+  
   /**
    * Helper to process property data loaded from an ICAO.threshold.xml file
    */