]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
#358: Missing option to disable AI scenarios
[flightgear.git] / src / AIModel / AIBase.cxx
index 514c6abb0498ad77eb133497fd2838e8c521948b..ac907c2e383e5263546dfa30df4f62493e9a3a54 100644 (file)
@@ -52,13 +52,14 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172;   //conversion factor
 
 using namespace simgear;
 
-FGAIBase::FGAIBase(object_type ot) :
+FGAIBase::FGAIBase(object_type ot, bool enableHot) :
     _max_speed(300),
     _name(""),
     _parent(""),
     props( NULL ),
     model_removed( fgGetNode("/ai/models/model-removed", true) ),
     manager( NULL ),
+    _installed(false),
     fp( NULL ),
     _impact_lat(0),
     _impact_lon(0),
@@ -120,6 +121,10 @@ FGAIBase::FGAIBase(object_type ot) :
     p = 1e5;
     a = 340;
     Mach = 0;
+
+    // explicitly disable HOT for (most) AI models
+    if (!enableHot)
+        aip.getSceneGraph()->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
 }
 
 FGAIBase::~FGAIBase() {
@@ -198,7 +203,7 @@ bool FGAIBase::init(bool search_in_AI_path) {
     string f;
     if(search_in_AI_path)
     {
-    // setup a modified Options strucutre, with only the $fg-root/AI defined;
+    // setup a modified Options structure, with only the $fg-root/AI defined;
     // we'll check that first, then give the normal search logic a chance.
     // this ensures that models in AI/ are preferred to normal models, where
     // both exist.
@@ -217,6 +222,8 @@ bool FGAIBase::init(bool search_in_AI_path) {
     
     if(f.empty())
         f = fgGetString("/sim/multiplay/default-model", default_model);
+    else
+        _installed = true;
 
     model = load3DModel(f, props);
 
@@ -229,6 +236,8 @@ bool FGAIBase::init(bool search_in_AI_path) {
 
     } else if (!model_path.empty()) {
         SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
+        // not properly installed...
+        _installed = false;
     }
 
     setDie(false);
@@ -606,7 +615,7 @@ double FGAIBase::_getRdot() const {
 }
 
 double FGAIBase::_getVS_fps() const {
-    return vs*60.0;
+    return vs/60.0;
 }
 
 double FGAIBase::_get_speed_east_fps() const {
@@ -618,7 +627,7 @@ double FGAIBase::_get_speed_north_fps() const {
 }
 
 void FGAIBase::_setVS_fps( double _vs ) {
-    vs = _vs/60.0;
+    vs = _vs*60.0;
 }
 
 double FGAIBase::_getAltitude() const {