diff --git a/src/audio_generic.h b/src/audio_generic.h index ab1ab3cf5e..12983b6b02 100644 --- a/src/audio_generic.h +++ b/src/audio_generic.h @@ -109,7 +109,6 @@ class GenericAudio : public AudioInterface { BgmChannel BGM_Channels[nr_of_bgm_channels]; SeChannel SE_Channels[nr_of_se_channels]; mutable bool BGM_PlayedOnceIndicator; - bool Muted; std::vector sample_buffer = {}; std::vector scrap_buffer = {}; diff --git a/src/game_character.cpp b/src/game_character.cpp index 02a2fb05bd..5f6338ec2b 100644 --- a/src/game_character.cpp +++ b/src/game_character.cpp @@ -40,9 +40,6 @@ Game_Character::Game_Character(Type type, lcf::rpg::SaveMapEventBase* d) : { } -Game_Character::~Game_Character() { -} - void Game_Character::SanitizeData(StringView name) { SanitizeMoveRoute(name, data()->move_route, data()->move_route_index, "move_route_index"); } diff --git a/src/game_character.h b/src/game_character.h index 152262723f..fc5cca9f82 100644 --- a/src/game_character.h +++ b/src/game_character.h @@ -45,10 +45,10 @@ class Game_Character { static StringView TypeToStr(Type t); - /** - * Destructor. - */ - virtual ~Game_Character(); + virtual ~Game_Character() = default; + Game_Character(Game_Character&&) = default; + Game_Character& operator=(const Game_Character&) = default; + Game_Character& operator=(Game_Character&&) = default; /** @return the type of character this is */ Type GetType() const; diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp index b8050742e4..bb23c45d4c 100644 --- a/src/game_interpreter.cpp +++ b/src/game_interpreter.cpp @@ -4567,7 +4567,7 @@ bool Game_Interpreter::CommandManiacRewriteMap(lcf::rpg::EventCommand const& com } int mode = com.parameters[0]; - bool is_replace_range = com.parameters[1] != 0; + //bool is_replace_range = com.parameters[1] != 0; FIXME not implemented bool is_upper_layer = com.parameters[2] != 0; int tile_index = ValueOrVariableBitfield(mode, 0, com.parameters[3]); diff --git a/src/scene_debug.cpp b/src/scene_debug.cpp index ff616b624d..f172d53580 100644 --- a/src/scene_debug.cpp +++ b/src/scene_debug.cpp @@ -316,8 +316,6 @@ void Scene_Debug::PushUiInterpreterView() { Push(eUiInterpreterView); - auto& idx = prev[mode]; - if (!was_range_list) { SetupUiRangeList(); } @@ -1249,7 +1247,7 @@ void Scene_Debug::UpdateInterpreterWindow(int index) { state = Game_Interpreter::GetForegroundInterpreter().GetState(); first_line = Game_Battle::IsBattleRunning() ? "Foreground (Battle)" : "Foreground (Map)"; valid = true; - } else if (index <= state_interpreter.ev.size()) { + } else if (index <= static_cast(state_interpreter.ev.size())) { evt_id = state_interpreter.ev[index - 1]; state = state_interpreter.state_ev[index - 1]; first_line = fmt::format("EV{:04d}: {}", evt_id, Game_Map::GetEvent(evt_id)->GetName()); diff --git a/src/window_settings.cpp b/src/window_settings.cpp index 0ad567c57c..82e20ee4ae 100644 --- a/src/window_settings.cpp +++ b/src/window_settings.cpp @@ -386,11 +386,15 @@ void Window_Settings::RefreshAudioSoundfont() { #endif } +#ifdef __clang__ +// FIXME: Binding &cfg in the lambdas below is not needed and generates a warning in clang but MSVC requires it +#pragma clang diagnostic ignored "-Wunused-lambda-capture" +#endif + void Window_Settings::RefreshEngine() { auto& cfg = Player::player_config; cfg.Hide(); - // FIXME: Binding &cfg is not needed and generates a warning but MSVC requires it AddOption(cfg.font1, [this, &cfg]() { font_size.Set(cfg.font1_size.Get()); Push(eEngineFont1); diff --git a/tests/font.cpp b/tests/font.cpp index d6a8e67c14..b6eb856d6c 100644 --- a/tests/font.cpp +++ b/tests/font.cpp @@ -8,7 +8,6 @@ TEST_SUITE_BEGIN("Font"); -constexpr char32_t escape = '\\'; constexpr int width = 240; constexpr int height = 80; constexpr int ch = 12; diff --git a/tests/move_route.cpp b/tests/move_route.cpp index f7eb69259a..b290f6b9f7 100644 --- a/tests/move_route.cpp +++ b/tests/move_route.cpp @@ -7,11 +7,22 @@ #include "game_switches.h" #include #include +#include #include "test_move_route.h" TEST_SUITE_BEGIN("MoveRoute"); +lcf::rpg::MoveRoute MakeRoute(int code, bool repeat = false, bool skip = false) { + lcf::rpg::MoveRoute mr; + lcf::rpg::MoveCommand mc; + mc.command_id = code; + mr.move_commands = { mc }; + mr.repeat = repeat; + mr.skippable = skip; + return mr; +} + lcf::rpg::MoveRoute MakeRoute(std::initializer_list cmds, bool repeat = false, bool skip = false) { lcf::rpg::MoveRoute mr; mr.move_commands = cmds; @@ -154,7 +165,7 @@ TEST_CASE("ForceMoveRouteDiffFreq") { static void testInvalidCmd(bool repeat, bool skip) { auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ -1 }}, repeat, skip); + auto mr = MakeRoute(-1, repeat, skip); ch.ForceMoveRoute(mr, 3); testMoveRoute(ch, false, 3, 0xFFFF, 64, 0, true, false, mr); @@ -188,7 +199,7 @@ static void testMove(lcf::rpg::MoveCommand::Code code, int x, int y, int dir, in ch.SetFacing(face); ch.SetAllowMovement(success); - auto mr = MakeRoute({{ static_cast(code) }}, repeat, skip); + auto mr = MakeRoute(static_cast(code), repeat, skip); CAPTURE(code); CAPTURE(x); @@ -444,7 +455,7 @@ static void testTurn(lcf::rpg::MoveCommand::Code code, int orig_dir, int dir, in ch.SetY(y); ch.SetDirection(orig_dir); ch.SetFacing(orig_dir); - auto mr = MakeRoute({{ static_cast(code) }}); + auto mr = MakeRoute(static_cast(code)); CAPTURE(code); CAPTURE(orig_dir); @@ -496,7 +507,7 @@ TEST_CASE("CommandTurnRandom") { for (int i = 0; i < 10; ++i) { auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::face_random_direction) }}); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::face_random_direction)); ch.ForceMoveRoute(mr, 3); testMoveRouteDir(ch, Down, Down, false, 3, 0xFFFF, 64, 0, true, false, mr); @@ -514,7 +525,7 @@ TEST_CASE("CommandWait") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::wait) }}); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::wait)); ch.ForceMoveRoute(mr, 2); testMoveRouteDir(ch, Down, Down, false, 2, 0xFFFF, 0, 0, true, false, mr); @@ -540,12 +551,16 @@ static void testJump(lcf::rpg::MoveCommand::Code code, int x, int y, int dir, in ch.SetFacing(face); ch.SetAllowMovement(success); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::begin_jump) }}, repeat, skip); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::begin_jump), repeat, skip); if (code != lcf::rpg::MoveCommand::Code::end_jump) { - mr.move_commands.push_back({ static_cast(code) }); + lcf::rpg::MoveCommand mc; + mc.command_id = static_cast(code); + mr.move_commands.push_back(mc); } if (end) { - mr.move_commands.push_back({ static_cast(lcf::rpg::MoveCommand::Code::end_jump) }); + lcf::rpg::MoveCommand mc; + mc.command_id = static_cast(lcf::rpg::MoveCommand::Code::end_jump); + mr.move_commands.push_back(mc); } auto num_cmds = static_cast(mr.move_commands.size()); @@ -883,7 +898,7 @@ void testLockFacing(lcf::rpg::EventPage::AnimType at) { auto ch = MoveRouteVehicle(); ch.SetAnimationType(at); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::lock_facing) }}); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::lock_facing)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 0, 0, true, false, mr); @@ -893,7 +908,7 @@ void testLockFacing(lcf::rpg::EventPage::AnimType at) { testMoveRoute(ch, false, 2, 0xFFFF + 1, 128, 1, false, false, mr); REQUIRE(ch.IsFacingLocked()); - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::unlock_facing) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::unlock_facing)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); REQUIRE(ch.IsFacingLocked()); @@ -913,8 +928,8 @@ TEST_CASE("CommandSpeedChange") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::increase_movement_speed) }}); - const int n = 10; + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::increase_movement_speed)); + //const int n = 10; ch.SetMoveSpeed(1); int prev = ch.GetMoveSpeed(); @@ -930,7 +945,7 @@ TEST_CASE("CommandSpeedChange") { prev= ch.GetMoveSpeed(); } - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::decrease_movement_speed) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::decrease_movement_speed)); for (int i = 0; i < 10; ++i) { ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); @@ -948,8 +963,7 @@ TEST_CASE("CommandFreqChange") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::increase_movement_frequence) }}); - const int n = 10; + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::increase_movement_frequence)); for (int i = 1; i < 10; ++i) { const int freq = Utils::Clamp(i, 1, 8); @@ -957,7 +971,7 @@ TEST_CASE("CommandFreqChange") { ch.ForceMoveRoute(mr, freq); testMoveRoute(ch, false, freq, 0xFFFF, (i == 0 && freq == 2 ? 0 : Game_Character::GetMaxStopCountForStep(freq)), 0, true, false, mr); - const int next_freq = Utils::Clamp(freq + 1, 1, 8); + //const int next_freq = Utils::Clamp(freq + 1, 1, 8); ForceUpdate(ch); // FIXME: Need another command for the frequency to not get reset when move route is done. //testMoveRoute(ch, false, next_freq, 0xFFFF + 1, Game_Character::GetMaxStopCountForStep(next_freq), 1, false, false, mr); @@ -966,7 +980,7 @@ TEST_CASE("CommandFreqChange") { } - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::decrease_movement_frequence) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::decrease_movement_frequence)); for (int i = 1; i < 10; ++i) { const int freq = Utils::Clamp(i, 1, 8); @@ -974,7 +988,7 @@ TEST_CASE("CommandFreqChange") { ch.ForceMoveRoute(mr, freq); testMoveRoute(ch, false, freq, 0xFFFF, Game_Character::GetMaxStopCountForStep(freq), 0, true, false, mr); - const int next_freq = Utils::Clamp(freq - 1, 1, 8); + //const int next_freq = Utils::Clamp(freq - 1, 1, 8); ForceUpdate(ch); // FIXME: Need another command for the frequency to not get reset when move route is done. //testMoveRoute(ch, false, next_freq, 0xFFFF + 1, Game_Character::GetMaxStopCountForStep(next_freq), 1, false, false, mr); @@ -986,8 +1000,8 @@ TEST_CASE("CommandTranspChange") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::increase_transp) }}); - const int n = 10; + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::increase_transp)); + //const int n = 10; ch.SetTransparency(0); int prev = ch.GetTransparency(); @@ -1003,7 +1017,7 @@ TEST_CASE("CommandTranspChange") { prev = ch.GetTransparency(); } - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::decrease_transp) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::decrease_transp)); for (int i = 0; i < 10; ++i) { ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); @@ -1021,7 +1035,7 @@ TEST_CASE("CommandThrough") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_on) }}); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_on)); auto testoff = [&]() { REQUIRE(!ch.GetThrough()); @@ -1047,7 +1061,7 @@ TEST_CASE("CommandThrough") { testMoveRoute(ch, false, 2, 0xFFFF + 1, 128, 1, false, false, mr); teston(); - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_off) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_off)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); teston(); @@ -1058,7 +1072,7 @@ TEST_CASE("CommandThrough") { ch.SetThrough(true); - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_off) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_off)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); REQUIRE(ch.GetThrough()); @@ -1068,7 +1082,7 @@ TEST_CASE("CommandThrough") { testoff(); ch.SetThrough(true); - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_on) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::walk_everywhere_on)); ch.ForceMoveRoute(mr, 2); REQUIRE(ch.GetThrough()); @@ -1081,7 +1095,7 @@ TEST_CASE("CommandStopAnimation") { const MapGuard mg; auto ch = MoveRouteVehicle(); - auto mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::stop_animation) }}); + auto mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::stop_animation)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 0, 0, true, false, mr); @@ -1091,7 +1105,7 @@ TEST_CASE("CommandStopAnimation") { testMoveRoute(ch, false, 2, 0xFFFF + 1, 128, 1, false, false, mr); REQUIRE(ch.IsAnimPaused()); - mr = MakeRoute({{ static_cast(lcf::rpg::MoveCommand::Code::start_animation) }}); + mr = MakeRoute(static_cast(lcf::rpg::MoveCommand::Code::start_animation)); ch.ForceMoveRoute(mr, 2); testMoveRoute(ch, false, 2, 0xFFFF, 128, 0, true, false, mr); REQUIRE(ch.IsAnimPaused()); diff --git a/tests/test_move_route.h b/tests/test_move_route.h index 0419faa5eb..896acae975 100644 --- a/tests/test_move_route.h +++ b/tests/test_move_route.h @@ -116,14 +116,14 @@ struct MapGuard { } }; -constexpr auto Up = Game_Character::Up; -constexpr auto Right = Game_Character::Right; -constexpr auto Down = Game_Character::Down; -constexpr auto Left = Game_Character::Left; -constexpr auto UpRight = Game_Character::UpRight; -constexpr auto DownRight = Game_Character::DownRight; -constexpr auto DownLeft = Game_Character::DownLeft; -constexpr auto UpLeft = Game_Character::UpLeft; +inline constexpr auto Up = Game_Character::Up; +inline constexpr auto Right = Game_Character::Right; +inline constexpr auto Down = Game_Character::Down; +inline constexpr auto Left = Game_Character::Left; +inline constexpr auto UpRight = Game_Character::UpRight; +inline constexpr auto DownRight = Game_Character::DownRight; +inline constexpr auto DownLeft = Game_Character::DownLeft; +inline constexpr auto UpLeft = Game_Character::UpLeft; } static void ForceUpdate(Game_Vehicle& ch) { @@ -131,7 +131,7 @@ static void ForceUpdate(Game_Vehicle& ch) { ch.Update(); } -static void ForceUpdate(Game_Player& ch) { +/*static void ForceUpdate(Game_Player& ch) { ch.SetProcessed(false); ch.Update(); } @@ -139,6 +139,6 @@ static void ForceUpdate(Game_Player& ch) { static void ForceUpdate(Game_Event& ch) { ch.SetProcessed(false); ch.Update(false); -} +}*/ #endif diff --git a/tests/text.cpp b/tests/text.cpp index 6041a08d82..aea1d43cfd 100644 --- a/tests/text.cpp +++ b/tests/text.cpp @@ -8,7 +8,6 @@ TEST_SUITE_BEGIN("Text"); -constexpr char32_t escape = '\\'; constexpr int width = 240; constexpr int height = 80; constexpr int ch = 12;