diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index b72fda88b..a9e9aa56d 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -627,86 +627,6 @@ var livery_update = { -# formation *** DEPRECATED *** -# ============================================================================= -# A modification of the livery class. This class maintains formation -# XML files (see Blackburn Buccaneer for an example). Files are regular -# PropertyList XML files whose properties are copied to the -# main tree (whereby the node types are ignored). -# -# SYNOPSIS: -# formation.init( [, [, ]]); -# -# ... directory with livery XML files, relative to $FG_ROOT -# ... property path to the livery name in the livery files -# and the property tree (default: /sim/model/formation/name) -# ... property path to the sort criterion (default: same as -# -- that is: alphabetic sorting) -# -# EXAMPLE: -# aircraft.formation.init("Aircraft/Buccaneer/Formations", -# "sim/model/formation/variant", -# "sim/model/formation/index"); # optional -# -# aircraft.formation.dialog.toggle(); -# aircraft.formation.select("take off"); -# aircraft.formation.next(); -# -var formation = { - init: func(formation_dir, name_path = "sim/model/formation/name", sort_path = nil) { - me.dir = formation_dir; - if (me.dir[-1] != `/`) - me.dir ~= "/"; - me.name_path = name_path; - me.sort_path = sort_path != nil ? sort_path : name_path; - me.rescan(); - aircraft.data.add(name_path); - me.dialog = gui.Dialog.new("formation-select"); - }, - rescan: func { - me.data = []; - var path = getprop("/sim/fg-root") ~ "/" ~ me.dir; - foreach (var file; directory(path)) { - if (substr(file, -4) != ".xml") - continue; - var n = io.read_properties(path ~ file); - var name = n.getNode(me.name_path); - var index = n.getNode(me.sort_path); - if (name == nil or index == nil) - continue; - append(me.data, [name.getValue(), index.getValue(), n.getValues()]); - } - me.data = sort(me.data, func(a, b) { - num(a[1]) == nil or num(b[1]) == nil ? cmp(a[1], b[1]) : a[1] - b[1]; - }); - me.select(getprop(me.name_path)); - }, - # select by index (out-of-bounds indices are wrapped) - set: func(i) { - print("***\n*** use of aircraft.formation is deprecated; use gui.OverlaySelector\n***"); - if (i < 0) - i = size(me.data) - 1; - if (i >= size(me.data)) - i = 0; - props.globals.setValues(me.data[i][2]); - me.current = i; - }, - # select by name - select: func(name) { - forindex (var i; me.data) - if (me.data[i][0] == name) - me.set(i); - }, - next: func { - me.set(me.current + 1); - }, - previous: func { - me.set(me.current - 1); - }, -}; - - - # steering # ============================================================================= # Class that implements differential braking depending on rudder position. diff --git a/Nasal/gui.nas b/Nasal/gui.nas index ea3cc7dba..ecb287aea 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -344,7 +344,6 @@ var OverlaySelector = { me.list.removeChildren("value"); forindex (var i; me.data) me.list.getChild("value", i, 1).setValue(me.data[i][0]); - settimer(func debug.dump(me.data), 10); }, set: func(index) { var last = me.current;