From db22f457b5f82551591a8b7955b98a00722b74b3 Mon Sep 17 00:00:00 2001
From: mfranz <mfranz>
Date: Sat, 13 May 2006 09:06:57 +0000
Subject: [PATCH] Vivian MEAZZA:

"Preparations for an upgrade to Air-to-Air Refuelling to allow more than one
tanker in the environment at a time. This will only work with YASim models.
JSBSim models are unaffected by this change."
---
 src/AIModel/AIAircraft.cxx | 7 +++++++
 src/AIModel/AIAircraft.hxx | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx
index a7ffc210d..cbb17ed62 100644
--- a/src/AIModel/AIAircraft.cxx
+++ b/src/AIModel/AIAircraft.cxx
@@ -111,14 +111,17 @@ void FGAIAircraft::bind() {
     props->tie("controls/gear/gear-down",
                SGRawValueMethods<FGAIAircraft,bool>(*this,
                                               &FGAIAircraft::_getGearDown));
+    props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
     props->setStringValue("callsign", callsign.c_str());
     props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
+    props->setBoolValue("tanker",isTanker);
 }
 
 void FGAIAircraft::unbind() {
     FGAIBase::unbind();
 
     props->untie("controls/gear/gear-down");
+    props->untie("refuel/contact");
 }
 
 
@@ -426,9 +429,13 @@ void FGAIAircraft::Run(double dt) {
           (y_shift > 0.0)    &&
           (elevation > 0.0) ) {
        refuel_node->setBoolValue(true);
+       contact = true;
      } else {
        refuel_node->setBoolValue(false);
+       contact = false;
      } 
+   } else {
+       contact = false;
    }
 }
 
diff --git a/src/AIModel/AIAircraft.hxx b/src/AIModel/AIAircraft.hxx
index 1fc46f1a3..36d315f7a 100644
--- a/src/AIModel/AIAircraft.hxx
+++ b/src/AIModel/AIAircraft.hxx
@@ -118,6 +118,7 @@ private:
   bool reachedWaypoint;
         string callsign;                      // The callsign of this tanker.
         string TACAN_channel_id;              // The TACAN channel of this tanker
+  bool contact;                               // set if this tanker is within fuelling range
 };