}
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)
- 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);
readXML(argv[1], fdm);
} catch (const sg_exception &e) {
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();
readXML(file, *fdm);
} catch (const sg_exception &e) {
printf("XML parse error: %s (%s)\n",
- e.getFormattedMessage().c_str(), e.getOrigin().c_str());
+ e.getFormattedMessage().c_str(), e.getOrigin());
}
// ... and run
string msg = txt;
msg += '\n';
msg += throwable.getFormattedMessage();
- if (!throwable.getOrigin().empty()) {
+ if (!std::strlen(throwable.getOrigin()) != 0) {
msg += "\n (reported by ";
msg += throwable.getOrigin();
msg += ')';
<< "\"\nUsing default: \"" << source << '"');
} else {
- throw sg_throwable(string("No joystick configuration file with "
- "<name>default</name> entry found!"));
+ throw sg_exception(string("No joystick configuration file with <name>")
+ + name + "</name> entry found!");
}
js_node = js_nodes->getChild("js", i, true);
void HUD::init()
{
+ const char* fontName = 0;
_font_cache = globals->get_fontcache();
+ if (!_font) {
+ fontName = fgGetString("/sim/hud/font/name", "Helvetica.txf");
+ _font = _font_cache->getTexFont(fontName);
+ }
if (!_font)
- _font = _font_cache->getTexFont(fgGetString("/sim/hud/font/name", "Helvetica.txf"));
- if (!_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(fontName));
_font_size = fgGetFloat("/sim/hud/font/size", 8);
_font_renderer->setFont(_font);
readProperties( config.str(), config_props );
if ( !build() ) {
- throw sg_throwable(string(
- "Detected an internal inconsistency in the instrumentation\n"
- "system specification file. See earlier errors for details."));
+ throw sg_error(
+ "Detected an internal inconsistency in the instrumentation\n"
+ "system specification file. See earlier errors for details.");
}
} catch (const sg_exception&) {
SG_LOG( SG_ALL, SG_ALERT, "Failed to load instrumentation system model: "
// logging, since logging may be
// disabled.
cerr << "Fatal error: " << t.getFormattedMessage() << endl;
- if (!t.getOrigin().empty())
+ if (std::strlen(t.getOrigin()) != 0)
cerr << " (received from " << t.getOrigin() << ')' << endl;
} catch (const string &s) {
} else if ( model == "yasim" ) {
cur_fdm_state = new YASim( dt );
} else {
- throw sg_throwable(string("Unrecognized flight model '") + model
+ throw sg_exception(string("Unrecognized flight model '") + model
+ "', cannot init flight dynamics model.");
}
}