Accept multiple names for the same joystick.
This commit is contained in:
parent
2a1ef0621e
commit
942cf9e51d
1 changed files with 14 additions and 7 deletions
|
@ -483,19 +483,26 @@ FGInput::_init_joystick ()
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
#ifdef FG_PLIB_JOYSTICK_GETNAME
|
#ifdef FG_PLIB_JOYSTICK_GETNAME
|
||||||
|
bool found_js = false;
|
||||||
const char * name = js->getName();
|
const char * name = js->getName();
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "Looking for bindings for joystick \""
|
SG_LOG(SG_INPUT, SG_INFO, "Looking for bindings for joystick \""
|
||||||
<< name << '"');
|
<< name << '"');
|
||||||
vector<SGPropertyNode_ptr> nodes = js_nodes->getChildren("js-named");
|
vector<SGPropertyNode_ptr> nodes = js_nodes->getChildren("js-named");
|
||||||
for (unsigned int i = 0; i < nodes.size(); i++) {
|
for (unsigned int i = 0; i < nodes.size(); i++) {
|
||||||
SGPropertyNode_ptr node = nodes[i];
|
SGPropertyNode_ptr node = nodes[i];
|
||||||
SG_LOG(SG_INPUT, SG_INFO,
|
vector<SGPropertyNode_ptr> name_nodes = node->getChildren("name");
|
||||||
" Trying \"" << node->getStringValue("name") << '"');
|
for (unsigned int j = 0; j < name_nodes.size(); j++) {
|
||||||
if (!strcmp(node->getStringValue("name"), name)) {
|
const char * js_name = name_nodes[j]->getStringValue();
|
||||||
SG_LOG(SG_INPUT, SG_INFO, " Found bindings");
|
SG_LOG(SG_INPUT, SG_INFO, " Trying \"" << js_name << '"');
|
||||||
js_node = node;
|
if (!strcmp(js_name, name)) {
|
||||||
break;
|
SG_LOG(SG_INPUT, SG_INFO, " Found bindings");
|
||||||
}
|
js_node = node;
|
||||||
|
found_js = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found_js)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue