| 126 | } |
| 127 | |
| 128 | void InputConfig::loadFromXML(pugi::xml_node node, int playerNum) |
| 129 | { |
| 130 | this->clear(); |
| 131 | |
| 132 | setPlayerNum(playerNum); |
| 133 | |
| 134 | for(pugi::xml_node input = node.child("input"); input; input = input.next_sibling("input")) |
| 135 | { |
| 136 | std::string name = input.attribute("name").as_string(); |
| 137 | std::string type = input.attribute("type").as_string(); |
| 138 | InputType typeEnum = stringToInputType(type); |
| 139 | |
| 140 | if(typeEnum == TYPE_COUNT) |
| 141 | { |
| 142 | LOG(LogError) << "InputConfig load error - input of type \"" << type << "\" is invalid! Skipping input \"" << name << "\".\n"; |
| 143 | continue; |
| 144 | } |
| 145 | |
| 146 | int id = input.attribute("id").as_int(); |
| 147 | int value = input.attribute("value").as_int(); |
| 148 | |
| 149 | if(value == 0) |
| 150 | LOG(LogWarning) << "WARNING: InputConfig value is 0 for " << type << " " << id << "!\n"; |
| 151 | |
| 152 | mNameMap[toLower(name)] = Input(mDeviceId, typeEnum, id, value, true); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | void InputConfig::writeToXML(pugi::xml_node parent) |
| 157 | { |
no test coverage detected