// FGAIWingman - FGAIBllistic-derived class creates an AI Wingman
//
// Written by Vivian Meazza, started February 2008.
-// - vivian.meazza at lineone.net
+// - vivian.meazza at lineone.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
{
invisible = false;
_formate_to_ac = true;
+
}
FGAIWingman::~FGAIWingman() {}
setLife(scFileNode->getDoubleValue("life", -1));
setNoRoll(scFileNode->getBoolValue("no-roll", false));
setName(scFileNode->getStringValue("name", "Wingman"));
- setSMPath(scFileNode->getStringValue("submodel-path", ""));
+ //setSMPath(scFileNode->getStringValue("submodel-path", ""));
setSubID(scFileNode->getIntValue("SubID", 0));
setXoffset(scFileNode->getDoubleValue("x-offset", 0.0));
setYoffset(scFileNode->getDoubleValue("y-offset", 0.0));
void FGAIWingman::bind() {
FGAIBallistic::bind();
+ props->tie("id", SGRawValueMethods<FGAIBase,int>(*this,
+ &FGAIBase::getID));
+ props->tie("subID", SGRawValueMethods<FGAIBase,int>(*this,
+ &FGAIBase::_getSubID));
+ props->tie("position/altitude-ft",
+ SGRawValueMethods<FGAIBase,double>(*this,
+ &FGAIBase::_getElevationFt,
+ &FGAIBase::_setAltitude));
+ props->tie("position/latitude-deg",
+ SGRawValueMethods<FGAIBase,double>(*this,
+ &FGAIBase::_getLatitude,
+ &FGAIBase::_setLatitude));
+ props->tie("position/longitude-deg",
+ SGRawValueMethods<FGAIBase,double>(*this,
+ &FGAIBase::_getLongitude,
+ &FGAIBase::_setLongitude));
+
+ props->tie("orientation/pitch-deg", SGRawValuePointer<double>(&pitch));
+ props->tie("orientation/roll-deg", SGRawValuePointer<double>(&roll));
+ props->tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
+
+ props->tie("submodels/serviceable", SGRawValuePointer<bool>(&serviceable));
+
props->tie("load/rel-brg-to-user-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getRelBrgHitchToUser));
props->tie("load/elev-to-user-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getElevHitchToUser));
+
props->tie("velocities/vertical-speed-fps",
- SGRawValuePointer<double>(&vs));
+ SGRawValuePointer<double>(&vs));
+ props->tie("velocities/true-airspeed-kt",
+ SGRawValuePointer<double>(&speed));
+ props->tie("velocities/speed-east-fps",
+ SGRawValuePointer<double>(&_speed_east_fps));
+ props->tie("velocities/speed-north-fps",
+ SGRawValuePointer<double>(&_speed_north_fps));
+
+
props->tie("position/x-offset",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getXOffset, &FGAIBase::setXoffset));
props->tie("position/y-offset",
props->tie("position/z-offset",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getZOffset, &FGAIBase::setZoffset));
props->tie("position/tgt-x-offset",
- SGRawValueMethods<FGAIWingman,double>(*this, &FGAIWingman::getTgtXOffset, &FGAIWingman::setTgtXOffset));
+ SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtXOffset, &FGAIBallistic::setTgtXOffset));
props->tie("position/tgt-y-offset",
- SGRawValueMethods<FGAIWingman,double>(*this, &FGAIWingman::getTgtYOffset, &FGAIWingman::setTgtYOffset));
+ SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtYOffset, &FGAIBallistic::setTgtYOffset));
props->tie("position/tgt-z-offset",
- SGRawValueMethods<FGAIWingman,double>(*this, &FGAIWingman::getTgtZOffset, &FGAIWingman::setTgtZOffset));
+ SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtZOffset, &FGAIBallistic::setTgtZOffset));
}
void FGAIWingman::unbind() {
FGAIBallistic::unbind();
+ props->untie("id");
+ props->untie("SubID");
+
+ props->untie("orientation/pitch-deg");
+ props->untie("orientation/roll-deg");
+ props->untie("orientation/true-heading-deg");
+
+ props->untie("submodels/serviceable");
+
+ props->untie("velocities/true-airspeed-kt");
+ props->untie("velocities/vertical-speed-fps");
+ props->untie("velocities/speed_east_fps");
+ props->untie("velocities/speed_north_fps");
+
props->untie("load/rel-brg-to-user-deg");
props->untie("load/elev-to-user-deg");
- props->untie("velocities/vertical-speed-fps");
+
+ props->untie("position/altitude-ft");
+ props->untie("position/latitude-deg");
+ props->untie("position/longitude-deg");
props->untie("position/x-offset");
props->untie("position/y-offset");
props->untie("position/z-offset");
roll = _rotation;
_ht_agl_ft = 1e10;
+ props->setStringValue("submodels/path", _path.c_str());
return true;
}
void FGAIWingman::update(double dt) {
FGAIBallistic::update(dt);
+// cout << FGAIBase::_getName() << " update speed " << FGAIBase::_getSpeed() << endl;
}
// end AIWingman