X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAITanker.cxx;h=73ec625381584d1a4c47db303c939718ff4dfd45;hb=9d995907db00728da7eac9297ecbab93ed8a7400;hp=6582e00e1c870d0069cba64d4edc27020872b513;hpb=0643b21baac1404bd037e5af8ec3865820644e62;p=flightgear.git diff --git a/src/AIModel/AITanker.cxx b/src/AIModel/AITanker.cxx index 6582e00e1..73ec62538 100644 --- a/src/AIModel/AITanker.cxx +++ b/src/AIModel/AITanker.cxx @@ -19,9 +19,14 @@ // 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 +#endif #include "AITanker.hxx" +using std::string; + FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){ } @@ -32,28 +37,31 @@ 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)); + tie("refuel/contact", SGRawValuePointer(&contact)); + 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"); -} - void FGAITanker::setTACANChannelID(const string& id) { TACAN_channel_id = 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 // @@ -76,4 +84,4 @@ void FGAITanker::update(double dt) { FGAIAircraft::update(dt); Run(dt); Transform(); -} \ No newline at end of file +}