Skip to content

Commit b50d5ae

Browse files
committed
fix (hopefully) all clang-tidy errors
1 parent 2e08e12 commit b50d5ae

File tree

7 files changed

+23
-21
lines changed

7 files changed

+23
-21
lines changed

.github/workflows/cpp-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
tidy-checks: ""
4949
step-summary: true
5050
file-annotations: true
51-
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|src/thirdparty
51+
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|src/libs/core/hash-library|wrapper/javascript/
5252

5353
- name: Fail CI run if linter checks failed
5454
if: steps.linter.outputs.checks-failed != 0

src/manager/music_manager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ MusicManager::MusicManager(ServiceProvider* service_provider, u8 channel_size)
2020
m_channel_size{ channel_size },
2121
m_chunk_map{ std::unordered_map<std::string, Mix_Chunk*>{} },
2222
m_service_provider{ service_provider },
23-
volume{ m_service_provider->command_line_arguments().silent ? std::nullopt : std::optional{ 1.0F } } {
23+
m_volume{ m_service_provider->command_line_arguments().silent ? std::nullopt : std::optional{ 1.0F } } {
2424
if (s_instance != nullptr) {
2525
spdlog::error("it's not allowed to create more than one MusicManager instance");
2626
return;
@@ -57,7 +57,7 @@ MusicManager::MusicManager(ServiceProvider* service_provider, u8 channel_size)
5757

5858
s_instance = this;
5959

60-
set_volume(volume, true);
60+
set_volume(m_volume, true);
6161
}
6262

6363
MusicManager::~MusicManager() noexcept {
@@ -95,7 +95,7 @@ std::optional<std::string> MusicManager::load_and_play_music(const std::filesyst
9595
}
9696

9797
// if we are mute, set the current music to this
98-
if (not volume.has_value()) {
98+
if (not m_volume.has_value()) {
9999
assert(m_queued_music == nullptr && "No queued music is possible, when muted!");
100100
if (m_music != nullptr) {
101101
Mix_FreeMusic(m_music);
@@ -258,7 +258,7 @@ void MusicManager::set_volume(
258258
const bool notify_listeners
259259
) {
260260

261-
if (volume == new_volume and not force_update) {
261+
if (m_volume == new_volume and not force_update) {
262262
return;
263263
}
264264

@@ -268,15 +268,15 @@ void MusicManager::set_volume(
268268
Mix_HaltMusic();
269269
}
270270

271-
volume = std::nullopt;
271+
m_volume = std::nullopt;
272272
}
273273

274274

275275
const int new_volume_mapped =
276276
not new_volume.has_value() ? 0 : static_cast<int>(MIX_MAX_VOLUME * new_volume.value());
277277
Mix_VolumeMusic(new_volume_mapped);
278278

279-
if (not volume.has_value()) {
279+
if (not m_volume.has_value()) {
280280

281281
if (m_music != nullptr) {
282282
const int result = Mix_PlayMusic(m_music, -1);
@@ -289,10 +289,10 @@ void MusicManager::set_volume(
289289
}
290290

291291

292-
volume = new_volume;
292+
m_volume = new_volume;
293293
if (notify_listeners) {
294-
for (const auto& [_, listener] : volume_listeners) {
295-
listener(volume);
294+
for (const auto& [_, listener] : m_volume_listeners) {
295+
listener(m_volume);
296296
}
297297
}
298298
}

src/manager/music_manager.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ struct MusicManager final {
3131
static constexpr unsigned fade_ms = 500;
3232
usize m_delay = MusicManager::fade_ms;
3333
ServiceProvider* m_service_provider;
34-
std::optional<double> volume;
35-
std::unordered_map<std::string, VolumeChangeFunction> volume_listeners;
34+
std::optional<double> m_volume;
35+
std::unordered_map<std::string, VolumeChangeFunction> m_volume_listeners;
3636

3737
public:
3838
explicit MusicManager(ServiceProvider* service_provider, u8 channel_size = 2);
@@ -58,20 +58,20 @@ struct MusicManager final {
5858

5959
bool add_volume_listener(const std::string& name, VolumeChangeFunction change_function) {
6060

61-
if (volume_listeners.contains(name)) {
61+
if (m_volume_listeners.contains(name)) {
6262
return false;
6363
}
6464

65-
volume_listeners.insert_or_assign(name, std::move(change_function));
65+
m_volume_listeners.insert_or_assign(name, std::move(change_function));
6666
return true;
6767
}
6868

6969
bool remove_volume_listener(const std::string& name) {
70-
if (not volume_listeners.contains(name)) {
70+
if (not m_volume_listeners.contains(name)) {
7171
return false;
7272
}
7373

74-
volume_listeners.erase(name);
74+
m_volume_listeners.erase(name);
7575
return true;
7676
}
7777

src/scenes/recording_selector/recording_selector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace scenes {
3434
private:
3535
ui::TileLayout m_main_layout;
3636
std::optional<details::recording::selector::Command> m_next_command{ std::nullopt };
37-
std::vector<std::filesystem::path> m_chosen_paths{};
37+
std::vector<std::filesystem::path> m_chosen_paths;
3838

3939
public:
4040
explicit RecordingSelector(ServiceProvider* service_provider, const ui::Layout& layout);

src/scenes/replay_game/replay_game.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace scenes {
1010
enum class NextScene : u8 { Pause, Settings };
1111

1212

13-
std::optional<NextScene> m_next_scene{};
13+
std::optional<NextScene> m_next_scene;
1414
std::vector<std::unique_ptr<Game>> m_games;
1515

1616
public:

src/scenes/single_player_game/single_player_game.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace scenes {
1111
enum class NextScene : u8 { Pause, Settings };
1212

1313

14-
std::optional<NextScene> m_next_scene{};
14+
std::optional<NextScene> m_next_scene;
1515
std::unique_ptr<Game> m_game;
1616

1717
public:

src/ui/layouts/focus_layout.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ namespace ui {
2626
FocusOptions m_options;
2727

2828
protected:
29-
std::optional<u32> m_focus_id{};
30-
std::vector<std::unique_ptr<Widget>> m_widgets{};
29+
std::optional<u32>
30+
m_focus_id; // NOLINT(misc-non-private-member-variables-in-classes,cppcoreguidelines-non-private-member-variables-in-classes)
31+
std::vector<std::unique_ptr<Widget>>
32+
m_widgets; // NOLINT(misc-non-private-member-variables-in-classes,cppcoreguidelines-non-private-member-variables-in-classes)
3133

3234
public:
3335
explicit FocusLayout(const Layout& layout, u32 focus_id, FocusOptions options, bool is_top_level);

0 commit comments

Comments
 (0)