]> git.mxchange.org Git - flightgear.git/commitdiff
New property identifying missing MP planes
authorThorstenB <brehmt@gmail.com>
Sat, 13 Nov 2010 15:29:34 +0000 (16:29 +0100)
committerThorstenB <brehmt@gmail.com>
Sat, 13 Nov 2010 15:29:34 +0000 (16:29 +0100)
Provide "model-installed" property at MP planes for pilot list.
Avoid direct directory access in Nasal (aircraft installed check).

src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIMultiplayer.cxx

index 514c6abb0498ad77eb133497fd2838e8c521948b..c206691a89436bc1503a88b33432ba1250a154c7 100644 (file)
@@ -60,6 +60,7 @@ FGAIBase::FGAIBase(object_type ot) :
     model_removed( fgGetNode("/ai/models/model-removed", true) ),
     manager( NULL ),
     fp( NULL ),
+    _installed(false),
     _impact_lat(0),
     _impact_lon(0),
     _impact_elev(0),
@@ -198,7 +199,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 +218,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 +232,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);
index 80a93c206b11d74a23510e1c53c29ffa9b9ab5c5..2f83623310c89f178ba42ff517f65920fcd7fd5b 100644 (file)
@@ -193,6 +193,7 @@ protected:
     bool invisible;
     bool no_roll;
     bool serviceable;
+    bool _installed;
     int _subID;
 
     double life;
index b2fe6b841636c38c11635aba75f25bdf0d64bcf8..476ddf205b54e1de4f3aa71ac315dab62ff240df 100644 (file)
@@ -63,7 +63,12 @@ bool FGAIMultiplayer::init(bool search_in_AI_path) {
         isTanker = true;
         //        cout << "isTanker " << isTanker << " " << mCallSign <<endl;
     }
-   return FGAIBase::init(search_in_AI_path);
+
+    // load model
+    bool result = FGAIBase::init(search_in_AI_path);
+    // propagate installation state (used by MP pilot list)
+    props->setBoolValue("model-installed", _installed);
+    return result;
 }
 
 void FGAIMultiplayer::bind() {