adapt to changes in sg_exception interface
sg_location now uses C strings. Also, change uses of sg_throwable to more specific exceptions like sg_io_exception.
This commit is contained in:
parent
d30398f2b2
commit
b588a92b7f
9 changed files with 21 additions and 15 deletions
|
@ -261,9 +261,11 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
}
|
}
|
||||||
|
|
||||||
FGFontCache *fc = globals->get_fontcache();
|
FGFontCache *fc = globals->get_fontcache();
|
||||||
HUD_Font = fc->getTexFont(fgGetString("/sim/hud/font/name", "Helvetica.txf"));
|
const char* fileName = fgGetString("/sim/hud/font/name", "Helvetica.txf");
|
||||||
|
HUD_Font = fc->getTexFont(fileName);
|
||||||
if (!HUD_Font)
|
if (!HUD_Font)
|
||||||
throw sg_throwable(string("/sim/hud/font/name is not a texture font"));
|
throw sg_io_exception("/sim/hud/font/name is not a texture font",
|
||||||
|
sg_location(fileName));
|
||||||
|
|
||||||
HUD_TextSize = fgGetFloat("/sim/hud/font/size", 10);
|
HUD_TextSize = fgGetFloat("/sim/hud/font/size", 10);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ int main(int argc, char** argv)
|
||||||
readXML(argv[1], fdm);
|
readXML(argv[1], fdm);
|
||||||
} catch (const sg_exception &e) {
|
} catch (const sg_exception &e) {
|
||||||
printf("XML parse error: %s (%s)\n",
|
printf("XML parse error: %s (%s)\n",
|
||||||
e.getFormattedMessage().c_str(), e.getOrigin().c_str());
|
e.getFormattedMessage().c_str(), e.getOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
Airplane* airplane = fdm.getAirplane();
|
Airplane* airplane = fdm.getAirplane();
|
||||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char** argv)
|
||||||
readXML(file, *fdm);
|
readXML(file, *fdm);
|
||||||
} catch (const sg_exception &e) {
|
} catch (const sg_exception &e) {
|
||||||
printf("XML parse error: %s (%s)\n",
|
printf("XML parse error: %s (%s)\n",
|
||||||
e.getFormattedMessage().c_str(), e.getOrigin().c_str());
|
e.getFormattedMessage().c_str(), e.getOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... and run
|
// ... and run
|
||||||
|
|
|
@ -141,7 +141,7 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable)
|
||||||
string msg = txt;
|
string msg = txt;
|
||||||
msg += '\n';
|
msg += '\n';
|
||||||
msg += throwable.getFormattedMessage();
|
msg += throwable.getFormattedMessage();
|
||||||
if (!throwable.getOrigin().empty()) {
|
if (!std::strlen(throwable.getOrigin()) != 0) {
|
||||||
msg += "\n (reported by ";
|
msg += "\n (reported by ";
|
||||||
msg += throwable.getOrigin();
|
msg += throwable.getOrigin();
|
||||||
msg += ')';
|
msg += ')';
|
||||||
|
|
|
@ -512,8 +512,8 @@ FGInput::_init_joystick ()
|
||||||
<< "\"\nUsing default: \"" << source << '"');
|
<< "\"\nUsing default: \"" << source << '"');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw sg_throwable(string("No joystick configuration file with "
|
throw sg_exception(string("No joystick configuration file with <name>")
|
||||||
"<name>default</name> entry found!"));
|
+ name + "</name> entry found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
js_node = js_nodes->getChild("js", i, true);
|
js_node = js_nodes->getChild("js", i, true);
|
||||||
|
|
|
@ -127,11 +127,15 @@ HUD::~HUD()
|
||||||
|
|
||||||
void HUD::init()
|
void HUD::init()
|
||||||
{
|
{
|
||||||
|
const char* fontName = 0;
|
||||||
_font_cache = globals->get_fontcache();
|
_font_cache = globals->get_fontcache();
|
||||||
|
if (!_font) {
|
||||||
|
fontName = fgGetString("/sim/hud/font/name", "Helvetica.txf");
|
||||||
|
_font = _font_cache->getTexFont(fontName);
|
||||||
|
}
|
||||||
if (!_font)
|
if (!_font)
|
||||||
_font = _font_cache->getTexFont(fgGetString("/sim/hud/font/name", "Helvetica.txf"));
|
throw sg_io_exception("/sim/hud/font/name is not a texture font",
|
||||||
if (!_font)
|
sg_location(fontName));
|
||||||
throw sg_throwable(string("/sim/hud/font/name is not a texture font"));
|
|
||||||
|
|
||||||
_font_size = fgGetFloat("/sim/hud/font/size", 8);
|
_font_size = fgGetFloat("/sim/hud/font/size", 8);
|
||||||
_font_renderer->setFont(_font);
|
_font_renderer->setFont(_font);
|
||||||
|
|
|
@ -70,9 +70,9 @@ FGInstrumentMgr::FGInstrumentMgr ()
|
||||||
readProperties( config.str(), config_props );
|
readProperties( config.str(), config_props );
|
||||||
|
|
||||||
if ( !build() ) {
|
if ( !build() ) {
|
||||||
throw sg_throwable(string(
|
throw sg_error(
|
||||||
"Detected an internal inconsistency in the instrumentation\n"
|
"Detected an internal inconsistency in the instrumentation\n"
|
||||||
"system specification file. See earlier errors for details."));
|
"system specification file. See earlier errors for details.");
|
||||||
}
|
}
|
||||||
} catch (const sg_exception&) {
|
} catch (const sg_exception&) {
|
||||||
SG_LOG( SG_ALL, SG_ALERT, "Failed to load instrumentation system model: "
|
SG_LOG( SG_ALL, SG_ALERT, "Failed to load instrumentation system model: "
|
||||||
|
|
|
@ -219,7 +219,7 @@ int main ( int argc, char **argv ) {
|
||||||
// logging, since logging may be
|
// logging, since logging may be
|
||||||
// disabled.
|
// disabled.
|
||||||
cerr << "Fatal error: " << t.getFormattedMessage() << endl;
|
cerr << "Fatal error: " << t.getFormattedMessage() << endl;
|
||||||
if (!t.getOrigin().empty())
|
if (std::strlen(t.getOrigin()) != 0)
|
||||||
cerr << " (received from " << t.getOrigin() << ')' << endl;
|
cerr << " (received from " << t.getOrigin() << ')' << endl;
|
||||||
|
|
||||||
} catch (const string &s) {
|
} catch (const string &s) {
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ void fgInitFDM() {
|
||||||
} else if ( model == "yasim" ) {
|
} else if ( model == "yasim" ) {
|
||||||
cur_fdm_state = new YASim( dt );
|
cur_fdm_state = new YASim( dt );
|
||||||
} else {
|
} else {
|
||||||
throw sg_throwable(string("Unrecognized flight model '") + model
|
throw sg_exception(string("Unrecognized flight model '") + model
|
||||||
+ "', cannot init flight dynamics model.");
|
+ "', cannot init flight dynamics model.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue