From dcffb9d3357d95350fdd169664f146bd83232044 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 2 Mar 2006 10:41:48 +0000 Subject: [PATCH] let removelistener() return the number of remaining Nasal listeners. (We need to return nil for errors and something else for success, so we can as well return something (remotely) useful.) --- src/Scripting/NasalSys.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 2415d5f9a..2cbedf80f 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -626,8 +626,9 @@ naRef FGNasalSys::setListener(int argc, naRef* args) FGNasalListener *nl = new FGNasalListener(node, handler, this, gcSave(handler)); - _listener[_listenerId] = nl; node->addChangeListener(nl, initial); + + _listener[_listenerId] = nl; return naNum(_listenerId++); } @@ -647,6 +648,6 @@ naRef FGNasalSys::removeListener(int argc, naRef* args) nl->_node->removeChangeListener(nl); _listener.erase(i); delete nl; - return id; + return naNum(_listener.size()); } -- 2.39.5