From e5348b67a50d456f315897471818ab758d6931e2 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 13 Nov 2010 16:29:34 +0100 Subject: [PATCH] New property identifying missing MP planes Provide "model-installed" property at MP planes for pilot list. Avoid direct directory access in Nasal (aircraft installed check). --- src/AIModel/AIBase.cxx | 7 ++++++- src/AIModel/AIBase.hxx | 1 + src/AIModel/AIMultiplayer.cxx | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 514c6abb0..c206691a8 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -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); diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index 80a93c206..2f8362331 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -193,6 +193,7 @@ protected: bool invisible; bool no_roll; bool serviceable; + bool _installed; int _subID; double life; diff --git a/src/AIModel/AIMultiplayer.cxx b/src/AIModel/AIMultiplayer.cxx index b2fe6b841..476ddf205 100644 --- a/src/AIModel/AIMultiplayer.cxx +++ b/src/AIModel/AIMultiplayer.cxx @@ -63,7 +63,12 @@ bool FGAIMultiplayer::init(bool search_in_AI_path) { isTanker = true; // cout << "isTanker " << isTanker << " " << mCallSign <setBoolValue("model-installed", _installed); + return result; } void FGAIMultiplayer::bind() { -- 2.39.5