From 83c37cc860f2fa6e91e56d14226b50bf2587055b Mon Sep 17 00:00:00 2001 From: durk Date: Mon, 9 Jul 2007 05:07:56 +0000 Subject: [PATCH] Publish and update callsigns of Traffic Manager (TM) created AITraffic. --- src/AIModel/AIAircraft.cxx | 17 +++++++++++++++-- src/AIModel/AIAircraft.hxx | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 8cc5089ad..897801b02 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -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(*this, &FGAIAircraft::_getGearDown)); - props->setStringValue("callsign", callsign.c_str()); + props->tie("callsign", + SGRawValueMethods(*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); } diff --git a/src/AIModel/AIAircraft.hxx b/src/AIModel/AIAircraft.hxx index b70c1ea62..cf8e6babc 100644 --- a/src/AIModel/AIAircraft.hxx +++ b/src/AIModel/AIAircraft.hxx @@ -137,6 +137,7 @@ private: bool holdPos; bool _getGearDown() const; + const char *_getCallSign() const; bool reachedWaypoint; string callsign; // The callsign of this tanker. -- 2.39.5