17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 19:09:25 +02:00

refactor(sonar): clean up issues reported on PR 209

- remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854)
- unnamed unused parameter (cpp:S1172)
- single-use declarations moved into if init-statements (cpp:S6004)
- auto for casted initialisers (cpp:S5827)
- const references and pointers where nothing is modified (cpp:S5350)
- rename structured bindings shadowed by inner declarations (cpp:S1117)
This commit is contained in:
jerrrrycho
2026-10-11 01:41:01 +02:00
parent 555e5f0aab
commit 2b74c6dba7
17 changed files with 37 additions and 50 deletions

View File

@@ -189,16 +189,16 @@ gamepad_input::recall_bindings() {
std::string bindingpoint {};
entryparser >> bindingpoint;
auto const [bindingtype, bindingindex]{ split_string_and_number( bindingpoint ) };
auto const [pointtype, pointindex]{ split_string_and_number( bindingpoint ) };
if( bindingtype == "axis" ) {
if( pointtype == "axis" ) {
// one or more sets of: [modeIDX] input type, parameters
// [optional] modeIDX associates the set with control mode IDX
// input types:
// -- range commandname IDX; axis value is passed as paramIDX of commandname
// -- 3state commandname commandname; positive axis value issues first commandname, negative value issues second commandname
auto const axisindex { bindingindex };
auto const axisindex { pointindex };
// sanity check, connected gamepad isn't guaranteed to have that many axes
if( axisindex >= m_inputaxes.size() ) { continue; }
@@ -265,9 +265,9 @@ gamepad_input::recall_bindings() {
}
}
}
else if( bindingtype == "button" ) {
else if( pointtype == "button" ) {
auto const buttonindex { bindingindex };
auto const buttonindex { pointindex };
// sanity check, connected gamepad isn't guaranteed to have that many buttons
if( buttonindex >= m_inputbuttons.size() ) { continue; }