17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-28 20:27:28 +01:00

refactor(sonar): assorted small fixes

- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 17:50:12 +02:00
parent 2e92076e21
commit b6186ced21
16 changed files with 28 additions and 29 deletions

View File

@@ -47,7 +47,7 @@ void ui::vehicles_bank::parse_entry(const std::string &line)
if (line[0] == '!')
parse_category_entry(param);
else if (line[0] == '*' && line[1] == '*')
else if (line.starts_with("**"))
parse_texture_rule(target.substr(2), param);
else if (line[0] == '*')
parse_coupling_rule(target.substr(1), param);
@@ -124,12 +124,12 @@ void ui::vehicles_bank::parse_texture_info(const std::string &target, const std:
set.meta = meta;
if (!mini.empty())
group_icons.try_emplace(mini, std::move(deferred_image("textures/mini/" + ToLower(mini) + ".bmp")));
group_icons.try_emplace(mini, deferred_image("textures/mini/" + ToLower(mini) + ".bmp"));
if (!miniplus.empty())
set.mini = std::move(deferred_image("textures/mini/" + ToLower(miniplus) + ".bmp"));
set.mini = deferred_image("textures/mini/" + ToLower(miniplus) + ".bmp");
else if (!mini.empty())
set.mini = std::move(deferred_image("textures/mini/" + ToLower(mini) + ".bmp"));
set.mini = deferred_image("textures/mini/" + ToLower(mini) + ".bmp");
set.skin = ToLower(target);
erase_extension(set.skin);