1 // AITanker.cxx Based on David Culp's AIModel code
2 // - Tanker specific code isolated from AI Aircraft code
3 // by Thomas Foerster, started June 2007
6 // Original code written by David Culp, started October 2003.
7 // - davidculp2@comcast.net/
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "AITanker.hxx"
25 FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){
28 FGAITanker::~FGAITanker() {}
30 void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
34 FGAIAircraft::readFromScenario(scFileNode);
35 setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID"));
38 void FGAITanker::bind() {
41 props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
42 props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
43 props->setBoolValue("tanker", true);
46 void FGAITanker::unbind() {
47 FGAIAircraft::unbind();
48 props->untie("refuel/contact");
51 void FGAITanker::setTACANChannelID(const string& id) {
52 TACAN_channel_id = id;
55 void FGAITanker::Run(double dt) {
56 FGAIAircraft::Run(dt);
58 //###########################//
59 // do calculations for radar //
60 //###########################//
61 double range_ft2 = UpdateRadar(manager);
63 // check if radar contact
64 if ( (range_ft2 < 250.0 * 250.0) && (y_shift > 0.0)
65 && (elevation > 0.0) ) {
66 //refuel_node->setBoolValue(true);
69 //refuel_node->setBoolValue(false);
75 void FGAITanker::update(double dt) {
76 FGAIAircraft::update(dt);