X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAITanker.cxx;h=ab7c8ed6dd7a240364977fb6b90020112c5b603f;hb=38226af24ec01e8f0a20d7fd73ef838a69f6ef25;hp=5d5d72a5b24888c331e919d5ad9c30757d81658a;hpb=97ed8554c61f0f56e3115e826c6a79e4c73e3ed9;p=flightgear.git diff --git a/src/AIModel/AITanker.cxx b/src/AIModel/AITanker.cxx index 5d5d72a5b..ab7c8ed6d 100644 --- a/src/AIModel/AITanker.cxx +++ b/src/AIModel/AITanker.cxx @@ -35,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(&contact)); + props->tie("position/altitude-agl-ft",SGRawValuePointer(&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) { @@ -56,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 // @@ -79,4 +88,4 @@ void FGAITanker::update(double dt) { FGAIAircraft::update(dt); Run(dt); Transform(); -} \ No newline at end of file +}