Add <name> tag so that AIWingman or other suitable AI Object can be attached.
Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
parent
1dc3ecf016
commit
00f26994b2
1 changed files with 90 additions and 90 deletions
|
@ -1,91 +1,91 @@
|
||||||
// AITanker.cxx Based on David Culp's AIModel code
|
// AITanker.cxx Based on David Culp's AIModel code
|
||||||
// - Tanker specific code isolated from AI Aircraft code
|
// - Tanker specific code isolated from AI Aircraft code
|
||||||
// by Thomas Foerster, started June 2007
|
// by Thomas Foerster, started June 2007
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Original code written by David Culp, started October 2003.
|
// Original code written by David Culp, started October 2003.
|
||||||
// - davidculp2@comcast.net/
|
// - davidculp2@comcast.net/
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License as
|
// modify it under the terms of the GNU General Public License as
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful, but
|
// This program is distributed in the hope that it will be useful, but
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// General Public License for more details.
|
// General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "AITanker.hxx"
|
#include "AITanker.hxx"
|
||||||
|
|
||||||
FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){
|
FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){
|
||||||
}
|
}
|
||||||
|
|
||||||
FGAITanker::~FGAITanker() {}
|
FGAITanker::~FGAITanker() {}
|
||||||
|
|
||||||
void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
|
void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
|
||||||
if (!scFileNode)
|
if (!scFileNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FGAIAircraft::readFromScenario(scFileNode);
|
FGAIAircraft::readFromScenario(scFileNode);
|
||||||
setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID",""));
|
setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID",""));
|
||||||
setName(scFileNode->getStringValue("name", "Tanker"));
|
setName(scFileNode->getStringValue("name", "Tanker"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAITanker::bind() {
|
void FGAITanker::bind() {
|
||||||
FGAIAircraft::bind();
|
FGAIAircraft::bind();
|
||||||
|
|
||||||
props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
|
props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
|
||||||
props->tie("position/altitude-agl-ft",SGRawValuePointer<double>(&altitude_agl_ft));
|
props->tie("position/altitude-agl-ft",SGRawValuePointer<double>(&altitude_agl_ft));
|
||||||
props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
|
props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
|
||||||
props->setStringValue("name", _name.c_str());
|
props->setStringValue("name", _name.c_str());
|
||||||
props->setBoolValue("tanker", true);
|
props->setBoolValue("tanker", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAITanker::unbind() {
|
void FGAITanker::unbind() {
|
||||||
FGAIAircraft::unbind();
|
FGAIAircraft::unbind();
|
||||||
props->untie("refuel/contact");
|
props->untie("refuel/contact");
|
||||||
props->untie("position/altitude-agl-ft");
|
props->untie("position/altitude-agl-ft");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAITanker::setTACANChannelID(const string& id) {
|
void FGAITanker::setTACANChannelID(const string& id) {
|
||||||
TACAN_channel_id = id;
|
TACAN_channel_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAITanker::Run(double dt) {
|
void FGAITanker::Run(double dt) {
|
||||||
//FGAIAircraft::Run(dt);
|
//FGAIAircraft::Run(dt);
|
||||||
|
|
||||||
double start = pos.getElevationFt() + 1000;
|
double start = pos.getElevationFt() + 1000;
|
||||||
altitude_agl_ft = _getAltitudeAGL(pos, start);
|
altitude_agl_ft = _getAltitudeAGL(pos, start);
|
||||||
|
|
||||||
//###########################//
|
//###########################//
|
||||||
// do calculations for radar //
|
// do calculations for radar //
|
||||||
//###########################//
|
//###########################//
|
||||||
double range_ft2 = UpdateRadar(manager);
|
double range_ft2 = UpdateRadar(manager);
|
||||||
|
|
||||||
// check if radar contact
|
// check if radar contact
|
||||||
if ( (range_ft2 < 250.0 * 250.0) && (y_shift > 0.0)
|
if ( (range_ft2 < 250.0 * 250.0) && (y_shift > 0.0)
|
||||||
&& (elevation > 0.0) ) {
|
&& (elevation > 0.0) ) {
|
||||||
//refuel_node->setBoolValue(true);
|
//refuel_node->setBoolValue(true);
|
||||||
contact = true;
|
contact = true;
|
||||||
} else {
|
} else {
|
||||||
//refuel_node->setBoolValue(false);
|
//refuel_node->setBoolValue(false);
|
||||||
contact = false;
|
contact = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGAITanker::update(double dt) {
|
void FGAITanker::update(double dt) {
|
||||||
FGAIAircraft::update(dt);
|
FGAIAircraft::update(dt);
|
||||||
Run(dt);
|
Run(dt);
|
||||||
Transform();
|
Transform();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue