From 4edcf7c7a0c143524d15caf551308fb8512d26e6 Mon Sep 17 00:00:00 2001 From: Anton Gomez Alvedro Date: Sun, 30 Nov 2014 10:46:26 +0100 Subject: [PATCH] Renaming the "Component" interface to "Updatable". "Component" is just too generic and inspecific to be used as a public interface. Also, making sure the looper is disabled when destruction is requested. --- .../Generic/soaring-instrumentation-sdk.nas | 2 +- Aircraft/Generic/update_loop.nas | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Aircraft/Generic/soaring-instrumentation-sdk.nas b/Aircraft/Generic/soaring-instrumentation-sdk.nas index 95b8cd77e..c82bb2d79 100644 --- a/Aircraft/Generic/soaring-instrumentation-sdk.nas +++ b/Aircraft/Generic/soaring-instrumentation-sdk.nas @@ -35,7 +35,7 @@ var sqr = func(x) {x * x} var InstrumentComponent = { - parents: [Component], + parents: [Updatable], output: 0, reset: func { me.output = 0 }, }; diff --git a/Aircraft/Generic/update_loop.nas b/Aircraft/Generic/update_loop.nas index b552f0df9..55de150de 100644 --- a/Aircraft/Generic/update_loop.nas +++ b/Aircraft/Generic/update_loop.nas @@ -17,21 +17,21 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# Component +# Updatable # -# The update loop accepts a vector of Components that it will update at regular -# intervals. In order to make custom components, you should add Component to -# the parents vector of your object: +# The update loop accepts a vector of Updatable elements that it will update at +# regular intervals. In order to make custom elements, you should add Updatable +# to the parents vector of your object: # -# var CustomComponent = { -# parents: [Component], +# var MyElement = { +# parents: [Updatable], # ... # }; # -# Your component shall then implement an "update" and a "reset" methods that +# Your component shall then implement an "update" and "reset" methods that # the UpdateLoop will call when needed. -var Component = { +var Updatable = { reset: func { }, update: func(dt) { }, }; @@ -55,7 +55,7 @@ var update_prop = func(property) { }; # UpdateLoop -# Wraps a set of components and updates them periodically. +# Wraps a set of user provided objects and updates them periodically. # Takes care of critical sim signals (reinit, fdm-initialized, speed-up). var UpdateLoop = { @@ -99,6 +99,7 @@ var UpdateLoop = { }, del: func { + me.disable(); foreach (var l; me.lst) removelistener(l); },