* Heiko Schulz -- Sunday 18 January 2009:
> He put his code in the forum, and I think it is worth
> enough not only to have a look into than comitting it
> into CVS!  

I'd like Stuart to have a look, as he already has such
a script. Maybe ideas of the less sophisticated one can
be used in the other.

I haven't tested the script from that forum link, I just
had a quick look. There are some points that I don't like:


- There are some "var" missing. Vector variables aren't
  special in this regard and deserve them, too. One is
  missing in a forindex().


- The script shouldn't just assume 12 engines, but use
  as many as there are: use the controls.engines vector.


- Why let the loop check if "interval" is zero? Better don't
  start the loop in the first place, then. Saves some
  cycles.


- Strings "true" and "false" should generally be avoided.
  In boolean context they are both 'true'. Only empty
  strings are 'false'. The script uses them in setprop(),
  where the strings work as intended if the property is a
  BOOL property, but it's still a potential source for
  errors. Just use 0 and 1 instead.


- Please no "camel style" or capitalized property names.
  If someone does that to his aircraft, that's one thing.
  But generic scripts should be consistent with the rest
  of fgfs:

  BAD:  /sim/failure-manager/Break/engine
  GOOD: /sim/failure-manager/break/engine

  BAD:  /sim/failure-manager/onScreenMessages
  GOOD: /sim/failure-manager/on-screen-messages


- All other dialogs are under /sim/gui/. The failure dialog
  should be there, as well.

  BAD:  /sim/failure-manager/GUI/multiplier
  GOOD: /sim/gui/failure-manager/multiplier


- Messages should better not be in upper-case letters, as this
  is inconsistent with the rest of fgfs. limits.nas doesn't do
  it either.  (OK, the bo105 has one "LOW FUEL WARNING",
  but that's not a system file, and it's also just a temporary
  thing until I have the warning lamp and fuel gauge.)

  Better use color for the messages than shouting:

  screen.log.write("FOO", 1, 0, 0);   # red


- There are still indentation bugs (e.g. resetDamages()), though
  apart from that the script is quite good, formally.


Again: all these points are only because this is meant to
be a system file in $FG_ROOT/Nasal/. Aircraft have more
freedom.  :-)

m.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to