1
0
Fork 0

Misc. Nasal cleanup

This commit is contained in:
Philosopher 2014-05-30 21:45:05 -05:00
parent ddcb543c10
commit 807062d0b6
3 changed files with 22 additions and 17 deletions

View file

@ -227,6 +227,11 @@ var wrapNode = func(node) { { parents : [Node], _g : node } }
#
var globals = wrapNode(_globals());
##
# Shortcut for props.globals.getNode().
#
var getNode = func return call(props.globals.getNode, arg, props.globals);
##
# Sets all indexed property children to a single value. arg[0]
# specifies a property name (e.g. /controls/engines/engine), arg[1] a

View file

@ -15,7 +15,7 @@ var RouteManagerDelegate = {
departureChanged: func
{
debug.dump('saw departure changed');
printlog('info', 'saw departure changed');
me.flightplan.clearWPType('sid');
if (me.flightplan.departure == nil)
return;
@ -36,13 +36,13 @@ var RouteManagerDelegate = {
# and we have a SID
var sid = me.flightplan.sid;
debug.dump('routing via SID ' ~ sid.id);
printlog('info', 'routing via SID ' ~ sid.id);
me.flightplan.insertWaypoints(sid.route(me.flightplan.departure_runway), 1);
},
arrivalChanged: func
{
debug.dump('saw arrival changed');
printlog('info', 'saw arrival changed');
me.flightplan.clearWPType('star');
me.flightplan.clearWPType('approach');
if (me.flightplan.destination == nil)
@ -57,17 +57,17 @@ var RouteManagerDelegate = {
}
if (me.flightplan.star != nil) {
debug.dump('routing via STAR ' ~ me.flightplan.star.id);
printlog('info', 'routing via STAR ' ~ me.flightplan.star.id);
var wps = me.flightplan.star.route(me.flightplan.destination_runway);
me.flightplan.insertWaypoints(wps, -1);
}
if (me.flightplan.approach != nil) {
debug.dump('routing via approach ' ~ me.flightplan.approach.id);
printlog('info', 'routing via approach ' ~ me.flightplan.approach.id);
var wps = me.flightplan.approach.route();
me.flightplan.insertWaypoints(wps, -1);
} else {
debug.dump('routing direct to runway ' ~ me.flightplan.destination_runway.id);
printlog('info', 'routing direct to runway ' ~ me.flightplan.destination_runway.id);
# no approach, just use the runway waypoint
var wp = createWPFrom(me.flightplan.destination_runway);
wp.wp_role = 'approach';
@ -77,14 +77,14 @@ var RouteManagerDelegate = {
cleared: func
{
debug.dump("saw active flightplan cleared, deactivating");
printlog('info', "saw active flightplan cleared, deactivating");
# see http://https://code.google.com/p/flightgear-bugs/issues/detail?id=885
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
},
endOfFlightPlan: func
{
debug.dump("end of flight-plan, deactivating");
printlog('info', "end of flight-plan, deactivating");
fgcommand("activate-flightplan", props.Node.new({"activate": 0}));
}
};
@ -105,7 +105,7 @@ var FMSDelegate = {
var wow = getprop('gear/gear[0]/wow');
var gs = getprop('velocities/groundspeed-kt');
if (wow and (gs < 25)) {
debug.dump('touchdown on destination runway, end of route.');
printlog('info', 'touchdown on destination runway, end of route.');
me.landingCheck.stop();
# record touch-down time?
me.flightplan.finish();
@ -118,7 +118,7 @@ var FMSDelegate = {
endOfFlightPlan: func
{
debug.dump('end of flight-plan');
printlog('info', 'end of flight-plan');
},
currentWaypointChanged: func
@ -128,12 +128,12 @@ var FMSDelegate = {
me.landingCheck = nil; # delete timer
}
#debug.dump('saw current WP changed, now ' ~ me.flightplan.current);
#printlog('info', 'saw current WP changed, now ' ~ me.flightplan.current);
var active = me.flightplan.currentWP();
if (active == nil) return;
if (active.alt_cstr_type == "at") {
debug.dump('new WP has valid altitude restriction, setting on AP');
printlog('info', 'new WP has valid altitude restriction, setting on AP');
setprop('/autopilot/settings/target-altitude-ft', active.alt_cstr);
}

View file

@ -17,7 +17,7 @@ command interface /autopilot/route-manager/input:
<resizable>true</resizable>
<nasal>
<open>
<open><![CDATA[
var ft = getprop("/sim/startup/units") == "feet";
var dlg = props.globals.getNode("/sim/gui/dialogs/route-manager", 1);
var selection = dlg.getNode("selection", 1);
@ -68,7 +68,7 @@ command interface /autopilot/route-manager/input:
var to = fp.getWP(sel_index());
if ((from == nil ) or (to == nil)) {
debug.dump('unable to route, invalid start ad end points');
printlog('info', 'unable to route, invalid start ad end points');
return;
}
@ -233,7 +233,7 @@ command interface /autopilot/route-manager/input:
var airborne = getprop('/gear/gear[0]/wow') == 0;
if (airborne) {
debug.dump('route-manager dialog, init in-air, clearing departure settings');
printlog('info', 'route-manager dialog, init in-air, clearing departure settings');
fp.departure = nil;
return;
}
@ -248,7 +248,7 @@ command interface /autopilot/route-manager/input:
}
if (fp.departure_runway == nil) {
debug.dump('selecting departure runway');
printlog('info', 'selecting departure runway');
var rwy = fp.departure.findBestRunwayForPos( geo.aircraft_position() );
fp.departure_runway = rwy;
}
@ -261,7 +261,7 @@ command interface /autopilot/route-manager/input:
updateSIDs();
updateSTARs();
updateApproaches();
</open>
]]></open>
<close>
file_selector.del();