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).
This commit is contained in:
parent
0a5e86f4e6
commit
e5348b67a5
3 changed files with 13 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -193,6 +193,7 @@ protected:
|
|||
bool invisible;
|
||||
bool no_roll;
|
||||
bool serviceable;
|
||||
bool _installed;
|
||||
int _subID;
|
||||
|
||||
double life;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue