1
0
Fork 0

aircraft.nas, gui.nas: adapt loadxml for absolute paths, drop second fgcommand arg

debug.nas, tutorial.nas: adapt for abs. paths
fuel.nas: cleanup
screen.nas: don't remove listeners -- that's done automatically by removind
    the node in NasalSys.cxx
xml.nas: minor documentation fix
This commit is contained in:
mfranz 2007-06-12 16:20:55 +00:00
parent eab53706ba
commit a1fd54cfdf
6 changed files with 11 additions and 13 deletions

View file

@ -542,7 +542,7 @@ var livery = {
foreach (var file; directory(getprop("/sim/fg-root") ~ "/" ~ me.dir)) {
if (substr(file, -4) != ".xml")
continue;
var n = props.Node.new({ filename : me.dir ~ file });
var n = props.Node.new({ filename : getprop("/sim/fg-root") ~ "/" ~ me.dir ~ file });
fgcommand("loadxml", n);
n = n.getNode("data");
@ -713,6 +713,7 @@ var autotrim = {
};
# HUD control class to handle both HUD implementations
# ==============================================================================
#
@ -763,8 +764,8 @@ var HUD = {
me.currentN = me.vis0N;
}
},
oldinit1 : func { fgcommand("hud-init", props.Node.new()) },
oldinit2 : func { fgcommand("hud-init2", props.Node.new()) },
oldinit1 : func { fgcommand("hud-init") },
oldinit2 : func { fgcommand("hud-init2") },
is_active : func { me.vis0N.getValue() or me.vis1N.getValue() },
};

View file

@ -242,7 +242,7 @@ if (getprop("/sim/logging/priority") != "alert") {
#
var load_xml_nasal = func(file) {
var n = props.globals.getNode("/tmp/nasal", 1);
n.getNode("filename", 1).setValue(file);
n.getNode("filename", 1).setValue(getprop("/sim/fg-root") ~ "/" ~ file);
n.getNode("targetnode", 1).setValue(n.getPath());
if (n.getNode("module", 0) == nil) {
var basename = split(".", split("/", file)[-1])[0];

View file

@ -191,7 +191,7 @@ Dialog = {
me.close();
me.prop.removeChildren();
fgcommand("loadxml", props.Node.new({"filename": me.path,
fgcommand("loadxml", props.Node.new({"filename": getprop("/sim/fg-root") ~ "/" ~ me.path,
"targetnode": me.prop.getPath()}));
var n = me.prop.getNode("name");
if (n == nil)
@ -301,7 +301,7 @@ nextStyle = func {
curr = 0;
}
setprop("/sim/gui/current-style", curr);
fgcommand("gui-redraw", props.Node.new());
fgcommand("gui-redraw");
}

View file

@ -198,8 +198,7 @@ window = {
var log = nil;
var L = _setlistener("/sim/signals/nasal-dir-initialized", func {
removelistener(L);
_setlistener("/sim/signals/nasal-dir-initialized", func {
setlistener("/sim/gui/current-style", func {
var theme = getprop("/sim/gui/current-style");
theme_font = getprop("/sim/gui/style[" ~ theme ~ "]/fonts/message-display/name");
@ -255,8 +254,7 @@ var callsign = nil;
var atclast = nil;
var listener = {};
var M = _setlistener("/sim/signals/nasal-dir-initialized", func {
removelistener(M);
_setlistener("/sim/signals/nasal-dir-initialized", func {
# set /sim/screen/nomap=true to prevent default message mapping
var nomap = getprop("/sim/screen/nomap");
if (nomap != nil and nomap) {

View file

@ -469,7 +469,7 @@ var dialog = func {
var load = func(file, index = 0) {
props.globals.getNode("/sim/tutorials", 1).removeChild("tutorial", index);
fgcommand("loadxml", props.Node.new({
"filename": file,
"filename": getprop("/sim/fg-root") ~ "/" ~ file,
"targetnode": "/sim/tutorials/tutorial[" ~ index ~ "]/",
}));
}

View file

@ -1,7 +1,6 @@
# XML parser that allows to parse XML files that don't follow the FlightGear standard by
# storing information in attributes, like the crappy Traffic Manager and AI definition
# files. Currently only reading from a string is supported, and the XML 1.0 standard
# isn't fully implemented.
# files.The XML 1.0 standard isn't fully implemented.
#
# Synopsis: xml.process_string(<xml-data:string>, <action:hash>);
# xml.process_file(<filepath>, <action:hash>);