]> git.mxchange.org Git - flightgear.git/commitdiff
Publish and update callsigns of Traffic Manager (TM) created AITraffic.
authordurk <durk>
Mon, 9 Jul 2007 05:07:56 +0000 (05:07 +0000)
committerdurk <durk>
Mon, 9 Jul 2007 05:07:56 +0000 (05:07 +0000)
src/AIModel/AIAircraft.cxx
src/AIModel/AIAircraft.hxx

index 8cc5089ad4e3c0de814af03691e43b51a29d0417..897801b02fe8f8b96bdc65f2a66c2106ebc755f9 100644 (file)
@@ -55,8 +55,10 @@ class FP_Inactive{};
 
 FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIBase(otAircraft) {
     trafficRef = ref;
-    if (trafficRef)
+    if (trafficRef) {
         groundOffset = trafficRef->getGroundOffset();
+       setCallSign(trafficRef->getCallSign());
+    }
     else
         groundOffset = 0;
 
@@ -81,6 +83,7 @@ FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIBase(otAircraft) {
     holdPos = false;
 
     _performance = 0; //TODO initialize to JET_TRANSPORT from PerformanceDB
+    
 }
 
 
@@ -110,7 +113,10 @@ void FGAIAircraft::bind() {
     props->tie("controls/gear/gear-down",
                SGRawValueMethods<FGAIAircraft,bool>(*this,
                                                     &FGAIAircraft::_getGearDown));
-    props->setStringValue("callsign", callsign.c_str());
+    props->tie("callsign",
+               SGRawValueMethods<FGAIAircraft,const char *>(*this,
+                                                    &FGAIAircraft::_getCallSign));
+    //props->setStringValue("callsign", callsign.c_str());
 }
 
 
@@ -118,6 +124,7 @@ void FGAIAircraft::unbind() {
     FGAIBase::unbind();
 
     props->untie("controls/gear/gear-down");
+    props->untie("callsign");
 }
 
 
@@ -318,12 +325,18 @@ bool FGAIAircraft::_getGearDown() const {
     return _performance->gearExtensible(this);
 }
 
+const char * FGAIAircraft::_getCallSign() const {
+    return callsign.c_str();
+}
+
 
 void FGAIAircraft::loadNextLeg() {
 
     int leg;
     if ((leg = fp->getLeg())  == 10) {
         trafficRef->next();
+        setCallSign(trafficRef->getCallSign());
+       //props->setStringValue("callsign", callsign.c_str());
         leg = 1;
         fp->setLeg(leg);
     }
index b70c1ea6244a0a2bb58a450d8096695b7ba297fb..cf8e6babce1fd12164a83b32bf18df5011b3c3ed 100644 (file)
@@ -137,6 +137,7 @@ private:
     bool holdPos;
 
     bool _getGearDown() const;
+    const char *_getCallSign() const;
     bool reachedWaypoint;
     string callsign;             // The callsign of this tanker.