From 831053bd043a2a65dfb92cce08bd14ec0604147c Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Sun, 27 Nov 2016 14:49:20 +0000
Subject: [PATCH] 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.
---
 src/Instrumentation/HUD/HUD.cxx | 1 +
 src/Model/modelmgr.cxx          | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/src/Instrumentation/HUD/HUD.cxx b/src/Instrumentation/HUD/HUD.cxx
index 722523fc7..1f3318144 100644
--- a/src/Instrumentation/HUD/HUD.cxx
+++ b/src/Instrumentation/HUD/HUD.cxx
@@ -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)),
diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx
index dee9fbb5d..2b2e35924 100644
--- a/src/Model/modelmgr.cxx
+++ b/src/Model/modelmgr.cxx
@@ -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;