#include "AIBase.hxx"
#include "AIManager.hxx"
-FGAIBase::FGAIBase() {
+
+const double FGAIBase::rho = 0.023780; // sea level air density slugs/ft3
+const double FGAIBase::lbs_to_slugs = 0.031080950172; //conversion factor
+
+
+FGAIBase::FGAIBase()
+ : fp( NULL ),
+ model( NULL ),
+ props( NULL ),
+ manager( NULL )
+{
_type_str = "model";
tgt_roll = roll = tgt_pitch = tgt_yaw = tgt_vs = vs = pitch = 0.0;
bearing = elevation = range = rdot = 0.0;
no_roll = true;
life = 900;
model_path = "";
- model = 0;
_otype = otNull;
index = 0;
- fp = (FGAIFlightPlan*)0;
delete_me = false;
- manager = NULL;
}
FGAIBase::~FGAIBase() {
SGPropertyNode *root = globals->get_props()->getNode("ai/models", true);
root->removeChild(_type_str.c_str(), index);
if (fp) delete fp;
+ fp = NULL;
}
void FGAIBase::update(double dt) {
void FGAIBase::bind() {
- props->tie("id", SGRawValuePointer<int>(&id));
+ props->tie("id", SGRawValueMethods<FGAIBase,int>(*this,
+ &FGAIBase::_getID));
props->tie("velocities/true-airspeed-kt", SGRawValuePointer<double>(&speed));
props->tie("velocities/vertical-speed-fps",
SGRawValueMethods<FGAIBase,double>(*this,
return (fgGetFloat("/sim/time/sun-angle-rad") > 1.57);
}
+int FGAIBase::_getID() const {
+ return (int)(this);
+}