From 8c4334e3ae365d2bc472e30039fb244c70877f91 Mon Sep 17 00:00:00 2001 From: Richard Harrison <rjh@zaretto.com> Date: Wed, 29 May 2019 20:25:28 +0200 Subject: [PATCH] Increase severity of warning when trying to add a setlistener onto a tied property - before this it was all to easy to miss being at DEBUG level and this is quite an important problem to be aware of for model developers --- src/Scripting/NasalSys.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 4e053a182..d6d272b95 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -1534,7 +1534,7 @@ naRef FGNasalSys::setListener(naContext c, int argc, naRef* args) } if(node->isTied()) - SG_LOG(SG_NASAL, SG_DEBUG, "Attaching listener to tied property " << + SG_LOG(SG_NASAL, SG_DEV_ALERT, "ERROR: Cannot add listener to tied property " << node->getPath()); naRef code = argc > 1 ? args[1] : naNil(); @@ -1543,8 +1543,8 @@ naRef FGNasalSys::setListener(naContext c, int argc, naRef* args) return naNil(); } - int init = argc > 2 && naIsNum(args[2]) ? int(args[2].num) : 0; - int type = argc > 3 && naIsNum(args[3]) ? int(args[3].num) : 1; + int init = argc > 2 && naIsNum(args[2]) ? int(args[2].num) : 0; // do not trigger when created + int type = argc > 3 && naIsNum(args[3]) ? int(args[3].num) : 1; // trigger will always be triggered when the property is written FGNasalListener *nl = new FGNasalListener(node, code, this, gcSave(code), _listenerId, init, type);