- global_tile_mgr.update( fgGetDouble("/position/longitude"),
- fgGetDouble("/position/latitude") );
- } else {
- SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
- exit(-1);
+ global_tile_mgr.update( longitude->getDoubleValue(),
+ latitude->getDoubleValue() );
+ // } else {
+ // SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
+ // exit(-1);
+ // }
+
+ // Delete then Initialize the flight model subsystem.
+ delete cur_fdm_state;
+
+ double dt = 1.0 / fgGetInt("/sim/model-hz");
+ aircraft_dir = fgGetString("/sim/aircraft-dir");
+ const string &model = fgGetString("/sim/flight-model");
+ try {
+ if (model == "larcsim") {
+ cur_fdm_state = new FGLaRCsim( dt );
+ } else if (model == "jsb") {
+ cur_fdm_state = new FGJSBsim( dt );
+ } else if (model == "ada") {
+ cur_fdm_state = new FGADA( dt );
+ } else if (model == "balloon") {
+ cur_fdm_state = new FGBalloonSim( dt );
+ } else if (model == "magic") {
+ cur_fdm_state = new FGMagicCarpet( dt );
+ } else if (model == "external") {
+ cur_fdm_state = new FGExternal( dt );
+ } else if (model == "null") {
+ cur_fdm_state = new FGNullFDM( dt );
+ } else if (model == "yasim") {
+ cur_fdm_state = new YASim( dt );
+ } else {
+ SG_LOG(SG_GENERAL, SG_ALERT,
+ "Unrecognized flight model '" << model
+ << "', cannot init flight dynamics model.");
+ exit(-1);
+ }
+ } catch ( ... ) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "FlightGear aborting\n\n");
+ exit(-1);