]> git.mxchange.org Git - flightgear.git/commitdiff
NasalTimerObject tweaks.
authorJames Turner <zakalawe@mac.com>
Wed, 20 Mar 2013 18:10:27 +0000 (18:10 +0000)
committerJames Turner <zakalawe@mac.com>
Wed, 20 Mar 2013 18:10:27 +0000 (18:10 +0000)
src/Scripting/NasalSys.cxx

index b7bf068a5f7ff7956c232fdc52fb7b06d1f0c942..184e75f7eb09b6bd17ca78797bff8af788a14922 100644 (file)
@@ -105,6 +105,8 @@ public:
     _sys->gcRelease(_gcSelf);
   }
   
+  bool isRunning() const { return _isRunning; }
+    
   void stop()
   {
     if (_isRunning) {
@@ -139,6 +141,9 @@ public:
   {
     naRef *args = NULL;
     _sys->callMethod(_func, _self, 0, args, naNil() /* locals */);
+    if (_singleShot) {
+      _isRunning = false;
+    }
   }
   
   void setSingleShot(bool aSingleShot)
@@ -783,7 +788,8 @@ void FGNasalSys::init()
       .method("start", &TimerObj::start)
       .method("stop", &TimerObj::stop)
       .method("restart", &TimerObj::restart)
-      .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot);
+      .member("singleShot", &TimerObj::isSingleShot, &TimerObj::setSingleShot)
+      .member("isRunning", &TimerObj::isRunning);
   
     // Now load the various source files in the Nasal directory
     simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));