From a0dc7b5ba3fdf110fe3b9716a3fd6a0a87a7a210 Mon Sep 17 00:00:00 2001
From: Edward d'Auvergne <edward@nmr-relax.com>
Date: Mon, 29 May 2017 09:45:20 +0200
Subject: [PATCH] Untied the /environment/moonlight property.

---
 src/Environment/ephemeris.cxx | 6 +++++-
 src/Environment/ephemeris.hxx | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Environment/ephemeris.cxx b/src/Environment/ephemeris.cxx
index 0c3bfabbe..cd17fae6d 100644
--- a/src/Environment/ephemeris.cxx
+++ b/src/Environment/ephemeris.cxx
@@ -72,10 +72,11 @@ void Ephemeris::init()
   tieMoonPos("/ephemeris/moon/lat-deg", _impl->get_moon(), &MoonPos::getLat);
   tieMoonPos("/ephemeris/moon/age", _impl->get_moon(), &MoonPos::getAge);
   tieMoonPos("/ephemeris/moon/phase", _impl->get_moon(), &MoonPos::getPhase);
-  tieMoonPos("/environment/moonlight", _impl->get_moon(), &MoonPos::getIlluminanceFactor);
 
     _latProp = fgGetNode("/position/latitude-deg", true);
 
+    _moonlight = fgGetNode("/environment/moonlight", true);
+
     update(0.0);
 }
 
@@ -102,4 +103,7 @@ void Ephemeris::update(double)
 {
     SGTime* st = globals->get_time_params();
     _impl->update(st->getMjd(), st->getLst(), _latProp->getDoubleValue());
+
+    // Update the moonlight intensity.
+    _moonlight->setDoubleValue(_impl->get_moon()->getIlluminanceFactor());
 }
diff --git a/src/Environment/ephemeris.hxx b/src/Environment/ephemeris.hxx
index 82d67521a..698b3165c 100644
--- a/src/Environment/ephemeris.hxx
+++ b/src/Environment/ephemeris.hxx
@@ -51,6 +51,7 @@ public:
 private:
   SGEphemeris* _impl;
   SGPropertyNode* _latProp;
+  SGPropertyNode* _moonlight;
 };
 
 #endif // of FG_ENVIRONMENT_EPHEMERIS_HXX