* Anders Gidenstam -- Saturday 07 July 2007:
> In my work on LZ-129 Hindenburg I discovered that I need to be able
> to quickly control the engines individually or in (sub)groups

I've thought in the past that the throttle should really respect
the selected engines.



> 1. throttleMouse(), throttleAxis() and incThrottle() only change the
>     throttle setting for the selected engines, i.e. those that have
>     /sim/input/selected/engine[i] == true

You shouldn't have things in the loop that don't change, though
it's certainly not a big performance problem. For example the
cmdarg().getNode("offset").getValue() * -4.

This code sets the same value for all selected engines to the js/mouse
value. But if they weren't all at the same level, this would mean that
some make abrupt jumps. Applying the same delta to all selected engines
would be nicer, but has its own problems ...  :-/



> 2. A new function controls.selectEngineToo(e_no) adds engine number e_no
>     to the set of active engines. The existing selectEngine() is mutually
>     exclusive - it deselects all other engines.

I'd rather make a function something like this:

  var selectEngines = func(state, engines...) {
      var sel = props.globals.getNode("/sim/input/selected");
      if(size(engines)) {
          foreach(var e; engines)
              sel.getChild("engine", e, 1).setBoolValue(state);
      } else {
          foreach(var e; sel.getChildren("engine"))
              e.setBoolValue(state);
      }
  }

One could then say

  selectEngines(1);            # select all engines
  selectEngines(0);            # unselect all engines
  selectEngines(1, 3, 5, 7);   # select engines 3, 5, and 7
  selectEngines(0, 4);         # unselect engine 4

That is: the first argument decides whether to select or unselect,
followed by a list of engine indices, to which the operation applies
(for example, all engines on the left of an airship). If no engines
are listed, then all of them are used. (Maybe a bit overengineered. ;-)

m.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to