1
0
Fork 0

Switch route-manager to use Nasal APIs for more commands.

Airways routing is now driven via Nasal.
This commit is contained in:
James Turner 2012-05-09 00:23:54 +01:00
parent 465ff76b27
commit 3389049325

View file

@ -38,7 +38,8 @@ command interface /autopilot/route-manager/input:
} }
var clear = func { var clear = func {
cmd.setValue("@clear"); #cmd.setValue("@clear");
flightplan().cleanPlan();
selection.setIntValue(-1); selection.setIntValue(-1);
} }
@ -59,15 +60,29 @@ command interface /autopilot/route-manager/input:
} }
var remove = func { var remove = func {
cmd.setValue("@delete" ~ sel_index()); #cmd.setValue("@delete" ~ sel_index());
flightplan().deleteWP(sel_index());
} }
var route = func { var route = func {
cmd.setValue("@route" ~ sel_index()); #cmd.setValue("@route" ~ sel_index());
var fp = flightplan();
var from = fp.getWP(sel_index() - 1);
var to = fp.getWP(sel_index());
if ((from == nil ) or (to == nil)) {
debug.dump('unable to route, invalid start ad end points');
return;
}
var route = airwaysRoute(from, to);
fp.insertWaypoints(route, sel_index());
} }
var jump_to = func { var jump_to = func {
cmd.setValue("@jump" ~ sel_index()); #cmd.setValue("@jump" ~ sel_index());
flightplan().current = sel_index();
} }
var load_route = func(path) { var load_route = func(path) {