+ // Create some FG{Eng|Gear}Interface objects
+ int i;
+ for(i=0; i<a->numGear(); i++) {
+ Gear* g = a->getGear(i);
+ SGPropertyNode * node = fgGetNode("gear/gear", i, true);
+ float pos[3];
+ g->getPosition(pos);
+ node->setDoubleValue("xoffset-in", pos[0]);
+ node->setDoubleValue("yoffset-in", pos[1]);
+ node->setDoubleValue("zoffset-in", pos[2]);
+ }
+// for(i=0; i<m->numThrusters(); i++) {
+// // Sanify the initial input conditions
+// char buf[64];
+// sprintf(buf, "/controls/engines/engine[%d]/throttle", i); fgSetFloat(buf, 0);
+// sprintf(buf, "/controls/engines/engine[%d]/mixture", i); fgSetFloat(buf, 1);
+// sprintf(buf, "/controls/engines/engine[%d]/propeller-pitch", i); fgSetFloat(buf, 1);
+// sprintf(buf, "/controls/engines/engine[%d]/augmentation", i); fgSetFloat(buf, 0);
+// }
+
+// fgSetFloat("/controls/flight/slats", 0);
+// fgSetFloat("/controls/flight/spoilers", 0);
+
+ // Are we at ground level? If so, lift the plane up so the gear
+ // clear the ground.
+ double runway_altitude = get_Runway_altitude();
+ if(get_Altitude() - runway_altitude < 50) {
+ fgSetBool("/controls/gear/gear-down", false);
+ float minGearZ = 1e18;
+ for(i=0; i<a->numGear(); i++) {
+ Gear* g = a->getGear(i);
+ float pos[3];
+ g->getPosition(pos);
+ if(pos[2] < minGearZ)
+ minGearZ = pos[2];
+ }
+ _set_Altitude(runway_altitude - minGearZ*M2FT);
+ fgSetBool("/controls/gear/gear-down", true);