If no keyboard input config is found, load a default.

(Previously would only load the keyboard default if *no* input configs were found.)
This commit is contained in:
Aloshi 2014-01-24 18:29:53 -06:00
parent 253ea2b5d3
commit 420dc912e0

View file

@ -228,6 +228,7 @@ void InputManager::loadConfig()
pugi::xml_node root = doc.child("inputList"); pugi::xml_node root = doc.child("inputList");
bool loadedKeyboard = false;
for(pugi::xml_node node = root.child("inputConfig"); node; node = node.next_sibling("inputConfig")) for(pugi::xml_node node = root.child("inputConfig"); node; node = node.next_sibling("inputConfig"))
{ {
std::string type = node.attribute("type").as_string(); std::string type = node.attribute("type").as_string();
@ -235,6 +236,7 @@ void InputManager::loadConfig()
if(type == "keyboard") if(type == "keyboard")
{ {
getInputConfigByDevice(DEVICE_KEYBOARD)->loadFromXML(node, mNumPlayers); getInputConfigByDevice(DEVICE_KEYBOARD)->loadFromXML(node, mNumPlayers);
loadedKeyboard = true;
mNumPlayers++; mNumPlayers++;
}else if(type == "joystick") }else if(type == "joystick")
{ {
@ -265,9 +267,9 @@ void InputManager::loadConfig()
delete[] configuredDevice; delete[] configuredDevice;
if(mNumPlayers == 0) if(!loadedKeyboard)
{ {
LOG(LogInfo) << "No input configs loaded. Loading default keyboard config."; LOG(LogInfo) << "No keyboard input found. Loading default keyboard config.";
loadDefaultConfig(); loadDefaultConfig();
} }