]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AITanker.cxx
Update VS2008 projects : use Boost 1.44.0 available in last 3rd Party archive
[flightgear.git] / src / AIModel / AITanker.cxx
index d184b2b97ec3abf49225d0a5176ccc6db555edd0..ab7c8ed6dd7a240364977fb6b90020112c5b603f 100644 (file)
@@ -19,6 +19,9 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include "AITanker.hxx"
 
@@ -32,20 +35,26 @@ void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
         return;
 
     FGAIAircraft::readFromScenario(scFileNode);
-    setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID"));
+    setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID",""));
+    setName(scFileNode->getStringValue("name", "Tanker"));
+
 }
 
 void FGAITanker::bind() {
     FGAIAircraft::bind();
 
     props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
+    props->tie("position/altitude-agl-ft",SGRawValuePointer<double>(&altitude_agl_ft));
     props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
+    props->setStringValue("name", _name.c_str());
     props->setBoolValue("tanker", true);
 }
 
 void FGAITanker::unbind() {
     FGAIAircraft::unbind();
     props->untie("refuel/contact");
+    props->untie("position/altitude-agl-ft");
+
 }
 
 void FGAITanker::setTACANChannelID(const string& id) {
@@ -53,7 +62,10 @@ void FGAITanker::setTACANChannelID(const string& id) {
 }
 
 void FGAITanker::Run(double dt) {
-    FGAIAircraft::Run(dt);
+    //FGAIAircraft::Run(dt);
+
+    double start = pos.getElevationFt() + 1000;
+    altitude_agl_ft = _getAltitudeAGL(pos, start);
 
     //###########################//
     // do calculations for radar //
@@ -70,3 +82,10 @@ void FGAITanker::Run(double dt) {
         contact = false;
     }
 }
+
+
+void FGAITanker::update(double dt) {
+     FGAIAircraft::update(dt);
+     Run(dt);
+     Transform();
+}