Use try/catch to flag FDM initialization errors.
This commit is contained in:
parent
3cca0caced
commit
c5c5a83ab2
1 changed files with 22 additions and 16 deletions
|
@ -509,24 +509,30 @@ bool fgInitSubsystems( void ) {
|
||||||
|
|
||||||
aircraft_dir = fgGetString("/sim/aircraft-dir");
|
aircraft_dir = fgGetString("/sim/aircraft-dir");
|
||||||
const string &model = fgGetString("/sim/flight-model");
|
const string &model = fgGetString("/sim/flight-model");
|
||||||
if (model == "larcsim") {
|
try {
|
||||||
cur_fdm_state = new FGLaRCsim( dt );
|
if (model == "larcsim") {
|
||||||
} else if (model == "jsb") {
|
cur_fdm_state = new FGLaRCsim( dt );
|
||||||
cur_fdm_state = new FGJSBsim( dt );
|
} else if (model == "jsb") {
|
||||||
} else if (model == "ada") {
|
cur_fdm_state = new FGJSBsim( dt );
|
||||||
cur_fdm_state = new FGADA( dt );
|
} else if (model == "ada") {
|
||||||
} else if (model == "balloon") {
|
cur_fdm_state = new FGADA( dt );
|
||||||
cur_fdm_state = new FGBalloonSim( dt );
|
} else if (model == "balloon") {
|
||||||
} else if (model == "magic") {
|
cur_fdm_state = new FGBalloonSim( dt );
|
||||||
cur_fdm_state = new FGMagicCarpet( dt );
|
} else if (model == "magic") {
|
||||||
} else if (model == "external") {
|
cur_fdm_state = new FGMagicCarpet( dt );
|
||||||
cur_fdm_state = new FGExternal( dt );
|
} else if (model == "external") {
|
||||||
} else {
|
cur_fdm_state = new FGExternal( dt );
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
} else {
|
||||||
"Unrecognized flight model '" << model
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
<< ", can't init aircraft");
|
"Unrecognized flight model '" << model
|
||||||
|
<< ", can't init aircraft");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
} catch ( ... ) {
|
||||||
|
SG_LOG(SG_GENERAL, SG_ALERT, "FlightGear aborting\n\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_fdm_state->init();
|
cur_fdm_state->init();
|
||||||
cur_fdm_state->bind();
|
cur_fdm_state->bind();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue