1
0
Fork 0

Fixes for HUD, model-manager listeners.

Make the HUD listener recursive (its tree is quite shallow) and 
manually watch the children of /models/model[n] nodes when they
are added.
This commit is contained in:
James Turner 2016-11-27 14:49:20 +00:00
parent b0fcd78e9f
commit 831053bd04
2 changed files with 6 additions and 0 deletions

View file

@ -82,6 +82,7 @@ HUD::Input::Input(const SGPropertyNode *n, float factor, float offset,
}
HUD::HUD() :
SGPropertyChangeListener(true /* recursive */),
_currentPath(fgGetNode("/sim/hud/current-path", true)),
_currentColor(fgGetNode("/sim/hud/current-color", true)),
_visibility(fgGetNode("/sim/hud/visibility[1]", true)),

View file

@ -267,6 +267,11 @@ FGModelMgr::Instance::~Instance ()
void
FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child)
{
if (!strcmp(parent->getName(), "models") && !strcmp(child->getName(), "model")) {
child->addChangeListener(this);
return;
}
if (strcmp(parent->getName(), "model") || strcmp(child->getName(), "load"))
return;