diff --git a/Nasal/gui.nas b/Nasal/gui.nas index f8a703a0c..089204565 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -22,7 +22,11 @@ var showDialog = func(name) { # Enable/disable named menu entry # var menuEnable = func(searchname, state) { - foreach (var menu; props.globals.getNode("/sim/menubar/default").getChildren("menu")) { + var menubar = props.globals.getNode("/sim/menubar/default"); + if (menubar == nil) + return; + + foreach (var menu; menubar.getChildren("menu")) { foreach (var name; menu.getChildren("name")) { if (name.getValue() == searchname) { menu.getNode("enabled").setBoolValue(state); @@ -142,7 +146,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { return 1; } menuEnable("autopilot", isAutopilotMenuEnabled() ); - menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js"))); + menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks", 1).getChildren("js"))); menuEnable("rendering-buffers", getprop("/sim/rendering/rembrandt/enabled")); menuEnable("rembrandt-buffers-choice", getprop("/sim/rendering/rembrandt/enabled")); menuEnable("stereoscopic-options", !getprop("/sim/rendering/rembrandt/enabled")); @@ -173,7 +177,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { var p = "/sim/rendering/precipitation-"; var precip_gui = getprop(p ~ "gui-enable"); var precip_ac = getprop(p ~ "aircraft-enable"); - props.globals.getNode(p ~ "enable").setAttribute("userarchive", 0); # TODO remove later + props.globals.getNode(p ~ "enable", 1).setAttribute("userarchive", 0); # TODO remove later var set_precip = func setprop(p ~ "enable", precip_gui and precip_ac); setlistener(p ~ "gui-enable", func(n) set_precip(precip_gui = n.getValue()),1); setlistener(p ~ "aircraft-enable", func(n) set_precip(precip_ac = n.getValue()),1); @@ -1470,7 +1474,7 @@ elsif (qualityLevel != nil) { # in the Rendering Options dialog var update_shader_settings = func() { if (!getprop("/sim/rendering/shaders/custom-settings")){ - var qualityLvl = getprop("/sim/rendering/shaders/quality-level-internal"); + var qualityLvl = getprop("/sim/rendering/shaders/quality-level-internal") or 0; setprop("/sim/rendering/shaders/quality-level", qualityLvl); setprop("/sim/rendering/shaders/landmass",qualityLvl); setprop("/sim/rendering/shaders/urban",qualityLvl); diff --git a/Nasal/view.nas b/Nasal/view.nas index 4514448fb..9818f27d0 100644 --- a/Nasal/view.nas +++ b/Nasal/view.nas @@ -935,8 +935,8 @@ var screenWidthCompens = { _setlistener("/sim/signals/nasal-dir-initialized", func { - views = props.globals.getNode("/sim").getChildren("view"); - fovProp = props.globals.getNode("/sim/current-view/field-of-view"); + views = props.globals.getNode("/sim", 1).getChildren("view"); + fovProp = props.globals.getNode("/sim/current-view/field-of-view", 1); point.init(); setlistener("/sim/current-view/view-number", func(n) { diff --git a/Nasal/windsock.nas b/Nasal/windsock.nas index 8d019ffd6..ae2332b05 100644 --- a/Nasal/windsock.nas +++ b/Nasal/windsock.nas @@ -9,8 +9,9 @@ var windsock = func { var wind = getprop("/environment/wind-speed-kt") or 0; var mag1 = getprop("/environment/turbulence/magnitude-norm") or 0; var mag2 = getprop("/environment/turbulence/raw-magnitude-norm") or 0; - var sens = getprop("/environment/turbulence/sensitivity") or 0; - var rate = 3.1514*getprop("/environment/turbulence/rate-hz") or 0; + var sens = getprop("/environment/turbulence/sensitivity") or 1.0; + var rateHz = getprop("/environment/turbulence/rate-hz") or 0; + var rate = 3.1514 * rateHz; var tot1 = math.sin(dt*rate)*mag1*mag1; var tot2 = math.sin(3.33*dt*rate/sens)*sens*mag2*mag2; tot2 = mag2*tot2 + (1-mag2)*math.tan(dt/10)/5;