diff --git a/src/FDM/UIUCModel/uiuc_aircraft.h b/src/FDM/UIUCModel/uiuc_aircraft.h index 65ff390ba..cda2abd2e 100644 --- a/src/FDM/UIUCModel/uiuc_aircraft.h +++ b/src/FDM/UIUCModel/uiuc_aircraft.h @@ -97,6 +97,8 @@ #include +#include + #include #include STL_IOSTREAM #include @@ -856,11 +858,11 @@ typedef struct #define gear_map aircraft_->gear_map #define MAX_GEAR 16 bool gear_model[MAX_GEAR]; - double D_gear_v[MAX_GEAR][3]; - double cgear[MAX_GEAR]; - double kgear[MAX_GEAR]; - double muGear[MAX_GEAR]; - double strutLength[MAX_GEAR]; + SCALAR D_gear_v[MAX_GEAR][3]; + SCALAR cgear[MAX_GEAR]; + SCALAR kgear[MAX_GEAR]; + SCALAR muGear[MAX_GEAR]; + SCALAR strutLength[MAX_GEAR]; #define D_gear_v aircraft_->D_gear_v #define gear_model aircraft_->gear_model #define cgear aircraft_->cgear diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index 8502f7282..2a4680673 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -162,18 +162,15 @@ FGInterface::init () void FGInterface::bind () { - // Time management + // Time management (read-only) fgTie("/fdm/time/delta_t", this, - &FGInterface::get_delta_t); - - // The following two can't be uncommented until we have support for - // the "long" data type in the property manager - /* fgTie("/fdm/time/elapsed", this, - &FGInterface::get_elapsed); + &FGInterface::get_delta_t); // read-only + fgTie("/fdm/time/elapsed", this, + &FGInterface::get_elapsed); // read-only fgTie("/fdm/time/remainder", this, - &FGInterface::get_remainder); */ + &FGInterface::get_remainder); // read-only fgTie("/fdm/time/multi_loop", this, - &FGInterface::get_multi_loop); + &FGInterface::get_multi_loop); // read-only // Aircraft position fgTie("/position/latitude", this, diff --git a/src/Main/fg_props.hxx b/src/Main/fg_props.hxx index 0b52d0c94..8a6c28bcd 100644 --- a/src/Main/fg_props.hxx +++ b/src/Main/fg_props.hxx @@ -45,6 +45,11 @@ inline int fgGetInt (const string &name, int defaultValue = 0) return globals->get_props()->getIntValue(name, defaultValue); } +inline int fgGetLong (const string &name, long defaultValue = 0L) +{ + return globals->get_props()->getLongValue(name, defaultValue); +} + inline float fgGetFloat (const string &name, float defaultValue = 0.0) { return globals->get_props()->getFloatValue(name, defaultValue); @@ -70,6 +75,11 @@ inline bool fgSetInt (const string &name, int val) return globals->get_props()->setIntValue(name, val); } +inline bool fgSetLong (const string &name, long val) +{ + return globals->get_props()->setLongValue(name, val); +} + inline bool fgSetFloat (const string &name, float val) { return globals->get_props()->setFloatValue(name, val); @@ -118,6 +128,15 @@ fgTie (const string &name, int *pointer, bool useDefault = true) "Failed to tie property " << name << " to a pointer"); } +inline void +fgTie (const string &name, long *pointer, bool useDefault = true) +{ + if (!globals->get_props()->tie(name, SGRawValuePointer(pointer), + useDefault)) + SG_LOG(SG_GENERAL, SG_WARN, + "Failed to tie property " << name << " to a pointer"); +} + inline void fgTie (const string &name, float *pointer, bool useDefault = true) { diff --git a/src/Main/main.cxx b/src/Main/main.cxx index e7191c577..8f69cd572 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -1568,18 +1568,17 @@ int main( int argc, char **argv ) { acmodel_selector = new ssgSelector; acmodel_pos = new ssgTransform; + // Get the model location, and load textures from the same + // directory. Use an absolute path for the model to avoid + // incompatibilities in different versions of PLIB. string acmodel_path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac"); - - string full_model = globals->get_fg_root() + "/" - + acmodel_path; - int pos = full_model.rfind("/"); - - SGPath texturepath( full_model.substr(0, pos) ); - cout << "Texture path = " << texturepath.str() << endl; - ssgTexturePath( (char *)texturepath.c_str() ); - - ssgEntity *acmodel_obj = ssgLoad((char *)(acmodel_path.c_str())); + SGPath full_model = globals->get_fg_root(); + full_model.append(acmodel_path); + // this should be redundant... + ssgModelPath( (char *)full_model.dir().c_str() ); + ssgTexturePath( (char *)full_model.dir().c_str() ); + ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() ); // find moving parts (if this is an MDL model) flaps_selector = (ssgSelector*)fgFindNode( acmodel_obj, "FLAPS" );