Browse Source

Improve logic and fix for old compilers

pull/5419/head
Gleb Mazovetskiy 3 years ago committed by Anders Jenbo
parent
commit
179ae009df
  1. 6
      Source/controls/controller.cpp
  2. 14
      Source/options.cpp

6
Source/controls/controller.cpp

@ -75,10 +75,8 @@ bool IsControllerButtonPressed(ControllerButton button)
bool IsControllerButtonComboPressed(ControllerButtonCombo combo)
{
bool comboPressed = IsControllerButtonPressed(combo.button);
if (combo.modifier != ControllerButton_NONE)
comboPressed = comboPressed && IsControllerButtonPressed(combo.modifier);
return comboPressed;
return IsControllerButtonPressed(combo.button)
&& (combo.modifier == ControllerButton_NONE || IsControllerButtonPressed(combo.modifier));
}
bool HandleControllerAddedOrRemovedEvent(const SDL_Event &event)

14
Source/options.cpp

@ -1494,15 +1494,17 @@ void PadmapperOptions::Action::LoadFromIni(string_view category)
std::string modName;
std::string buttonName;
for (string_view name : SplitByChar(result.data(), '+')) {
modName = buttonName;
buttonName = name;
}
if (buttonName.empty()) {
auto parts = SplitByChar(result.data(), '+');
auto it = parts.begin();
if (it == parts.end()) {
SetValue(ControllerButtonCombo {});
return;
}
buttonName = std::string(*it);
if (++it != parts.end()) {
modName = std::move(buttonName);
buttonName = std::string(*it);
}
ControllerButtonCombo input {};
if (!modName.empty()) {

Loading…
Cancel
Save