throw an exception if not even a default joystick could be found;
This can only happen if $FG_ROOT is corrupted or some developer has broken the default js config. Better not keep that under the rug.
This commit is contained in:
parent
325d545132
commit
4a1eadbf35
1 changed files with 5 additions and 9 deletions
|
@ -438,7 +438,7 @@ FGInput::_init_joystick ()
|
||||||
int js_named_index = 1000;
|
int js_named_index = 1000;
|
||||||
_scan_joystick_dir(&path, js_nodes, &js_named_index);
|
_scan_joystick_dir(&path, js_nodes, &js_named_index);
|
||||||
|
|
||||||
// build name->node map for each <name> (reverse order)
|
// build name->node map with each <name> (reverse order)
|
||||||
map<string, SGPropertyNode_ptr> jsmap;
|
map<string, SGPropertyNode_ptr> jsmap;
|
||||||
vector<SGPropertyNode_ptr> js_named = js_nodes->getChildren("js-named");
|
vector<SGPropertyNode_ptr> js_named = js_nodes->getChildren("js-named");
|
||||||
|
|
||||||
|
@ -469,20 +469,16 @@ FGInput::_init_joystick ()
|
||||||
SGPropertyNode_ptr named;
|
SGPropertyNode_ptr named;
|
||||||
|
|
||||||
if ((named = jsmap[name])) {
|
if ((named = jsmap[name])) {
|
||||||
string source = named->getStringValue("source", "");
|
string source = named->getStringValue("source", "user defined");
|
||||||
if (source.empty())
|
SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"');
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "... found joystick (user defined)");
|
|
||||||
else
|
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"');
|
|
||||||
|
|
||||||
} else if ((named = jsmap["default"])) {
|
} else if ((named = jsmap["default"])) {
|
||||||
string source = named->getStringValue("source", "");
|
string source = named->getStringValue("source", "user defined");
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "No config found for joystick \"" << name
|
SG_LOG(SG_INPUT, SG_INFO, "No config found for joystick \"" << name
|
||||||
<< "\"\nUsing default: \"" << source << '"');
|
<< "\"\nUsing default: \"" << source << '"');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_INPUT, SG_ALERT, "No default joystick found! (<name>default</name>)");
|
throw sg_throwable(string("No default joystick found! (<name>default</name>)"));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
js_node = js_nodes->getChild("js", i, true);
|
js_node = js_nodes->getChild("js", i, true);
|
||||||
|
|
Loading…
Reference in a new issue