From fd063bdc31461d37848778097822888f400f1685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 22 Feb 2018 17:54:19 +0100 Subject: [PATCH 1/3] Qt: Use std::abs instead of abs ...since is included, not . May or may not fix https://bugs.dolphin-emu.org/issues/10906 --- Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp index a7bf10a63f..9431eff864 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp @@ -171,7 +171,7 @@ void MappingIndicator::DrawStick() // Emulated cursor position float virt_curx, virt_cury; - if (abs(curx) < deadzone && abs(cury) < deadzone) + if (std::abs(curx) < deadzone && std::abs(cury) < deadzone) { virt_curx = virt_cury = 0; } From f1f2bd9c946422c51e909b9e67f75da99a115a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 22 Feb 2018 17:54:58 +0100 Subject: [PATCH 2/3] Qt: Fix warning about array initialisation --- Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp index 9431eff864..0d8b892cd5 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp @@ -182,7 +182,7 @@ void MappingIndicator::DrawStick() } // Coordinates for an octagon - std::array radius_octagon = { + std::array radius_octagon = {{ QPointF(centerx, centery + stick_size), // Bottom QPointF(centerx + stick_size / sqrt(2), centery + stick_size / sqrt(2)), // Bottom Right QPointF(centerx + stick_size, centery), // Right @@ -191,7 +191,7 @@ void MappingIndicator::DrawStick() QPointF(centerx - stick_size / sqrt(2), centery - stick_size / sqrt(2)), // Top Left QPointF(centerx - stick_size, centery), // Left QPointF(centerx - stick_size / sqrt(2), centery + stick_size / sqrt(2)) // Bottom Left - }; + }}; QPainter p(this); From 1e6dc196aa49f768dfece25b0be7c1af957dce92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 22 Feb 2018 17:55:16 +0100 Subject: [PATCH 3/3] Qt: Fix warning about parentheses The original code had parentheses placed in weird locations IMO, which even caused compilers to issue warnings. --- Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp index 0d8b892cd5..3979d32ef0 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingIndicator.cpp @@ -233,12 +233,12 @@ void MappingIndicator::DrawMixedTriggers() double r_bar_percent = r_analog; double l_bar_percent = l_analog; - if (r_button && (r_button != r_analog) || (r_button == r_analog) && (r_analog > threshold)) + if ((r_button && r_button != r_analog) || (r_button == r_analog && r_analog > threshold)) r_bar_percent = 1; else r_bar_percent *= 0.8; - if (l_button && (l_button != l_analog) || (l_button == l_analog) && (l_analog > threshold)) + if ((l_button && l_button != l_analog) || (l_button == l_analog && l_analog > threshold)) l_bar_percent = 1; else l_bar_percent *= 0.8;