Saving works now!
This commit is contained in:
parent
82631ed689
commit
f01fc6bc6a
1 changed files with 7 additions and 13 deletions
|
@ -100,24 +100,20 @@ var WaypointDatabase = {
|
||||||
write: func() {
|
write: func() {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Export/savedWaypoints.xml";
|
var path = getprop("/sim/fg-home") ~ "/Export/savedWaypoints.xml";
|
||||||
var tree = {
|
var tree = {
|
||||||
"waypoints": {
|
waypoints: {
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var node = props.Node.new(tree);
|
|
||||||
|
|
||||||
for (var i = 0; i < me.getSize(); i = i + 1) {
|
for (var i = 0; i < me.getSize(); i = i + 1) {
|
||||||
if (me.waypointsVec[i] != nil) {
|
if (me.waypointsVec[i] != nil) {
|
||||||
node.getChild("waypoints").addChild(me.waypointsVec[i].tree);
|
tree.waypoints["waypoint" ~ i] = me.waypointsVec[i].tree;
|
||||||
debug.dump(me.waypointsVec[i].tree);
|
|
||||||
} else {
|
} else {
|
||||||
node.getChild("waypoints").addChild(nilTree);
|
tree.waypoints["waypoint" ~ i] = nilTree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug.dump(node);
|
|
||||||
|
|
||||||
io.writexml(path, node); # write the data
|
io.writexml(path, props.Node.new(tree)); # write the data
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,11 +138,9 @@ var pilotWaypoint = {
|
||||||
pilotWp.wpGhost = createWP(positioned, pilotWp.id);
|
pilotWp.wpGhost = createWP(positioned, pilotWp.id);
|
||||||
|
|
||||||
pilotWp.tree = {
|
pilotWp.tree = {
|
||||||
"waypoint": {
|
"latitude": pilotWp.wpGhost.wp_lat,
|
||||||
"latitude": pilotWp.wpGhost.wp_lat,
|
"longitude": pilotWp.wpGhost.wp_lon,
|
||||||
"longitude": pilotWp.wpGhost.wp_lon,
|
"ident": pilotWp.id,
|
||||||
"ident": pilotWp.id,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return pilotWp;
|
return pilotWp;
|
||||||
|
|
Loading…
Reference in a new issue