From 9bf1fd48b07c4c1a4c1ea4907fad642f87ede18f Mon Sep 17 00:00:00 2001 From: obligaron Date: Sun, 5 Nov 2023 18:23:53 +0100 Subject: [PATCH] Fix a few MSVC warnings (#6782) --- Source/levels/drlg_l4.cpp | 2 +- Source/portal.cpp | 2 +- Source/utils/soundsample.cpp | 2 +- test/missiles_test.cpp | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/levels/drlg_l4.cpp b/Source/levels/drlg_l4.cpp index 1400c1722..755a57fc2 100644 --- a/Source/levels/drlg_l4.cpp +++ b/Source/levels/drlg_l4.cpp @@ -304,7 +304,7 @@ void MakeDmt() { for (int y = 0; y < DMAXY - 1; y++) { for (int x = 0; x < DMAXX - 1; x++) { - int val = (DungeonMask.test(x + 1, y + 1) << 3) | (DungeonMask.test(x, y + 1) << 2) | (DungeonMask.test(x + 1, y) << 1) | DungeonMask.test(x, y); + int val = (DungeonMask.test(x + 1, y + 1) << 3) | (DungeonMask.test(x, y + 1) << 2) | (DungeonMask.test(x + 1, y) << 1) | (DungeonMask.test(x, y) << 0); dungeon[x][y] = L4ConvTbl[val]; } } diff --git a/Source/portal.cpp b/Source/portal.cpp index db6b021e0..b7b90d1c2 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -101,7 +101,7 @@ void DeactivatePortal(int i) bool PortalOnLevel(size_t i) { - if (Portals[i].setlvl == setlevel && Portals[i].level == setlevel ? static_cast(setlvlnum) : currlevel) + if (Portals[i].setlvl == setlevel && Portals[i].level == (setlevel ? static_cast(setlvlnum) : currlevel)) return true; return leveltype == DTYPE_TOWN; diff --git a/Source/utils/soundsample.cpp b/Source/utils/soundsample.cpp index 5ff865b6c..fa81f321c 100644 --- a/Source/utils/soundsample.cpp +++ b/Source/utils/soundsample.cpp @@ -32,7 +32,7 @@ constexpr float LogBase = 10.0; * Picked so that a volume change of -10 dB results in half perceived loudness. * VolumeScale = -1000 / log(0.5) */ -constexpr float VolumeScale = 3321.9281; +constexpr float VolumeScale = 3321.9281F; /** * Min and max volume range, in millibel. diff --git a/test/missiles_test.cpp b/test/missiles_test.cpp index e4ef2ac35..1a56600f2 100644 --- a/test/missiles_test.cpp +++ b/test/missiles_test.cpp @@ -11,7 +11,7 @@ using ::testing::Lt; using ::testing::Pair; using ::testing::UnorderedElementsAre; -void TestArrowRotatesUniformly(Missile &missile, int startingFrame, int leftFrame, int rightFrame) +void TestArrowRotatesUniformly(Missile &missile, int startingFrame, unsigned leftFrame, unsigned rightFrame) { std::unordered_map observed {}; for (auto i = 0; i < 100; i++) { @@ -20,7 +20,7 @@ void TestArrowRotatesUniformly(Missile &missile, int startingFrame, int leftFram observed[missile._miAnimFrame]++; } - EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftFrame, AllOf(Gt(30), Lt(70))), Pair(rightFrame, AllOf(Gt(30), Lt(70))))) << "Arrows should rotate either direction roughly 50% of the time"; + EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftFrame, AllOf(Gt(30U), Lt(70U))), Pair(rightFrame, AllOf(Gt(30U), Lt(70U))))) << "Arrows should rotate either direction roughly 50% of the time"; } void TestAnimatedMissileRotatesUniformly(Missile &missile, int startingDir, int leftDir, int rightDir) @@ -32,7 +32,7 @@ void TestAnimatedMissileRotatesUniformly(Missile &missile, int startingDir, int observed[missile._mimfnum]++; } - EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftDir, AllOf(Gt(30), Lt(70))), Pair(rightDir, AllOf(Gt(30), Lt(70))))) << "Animated missiles should rotate either direction roughly 50% of the time"; + EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftDir, AllOf(Gt(30U), Lt(70U))), Pair(rightDir, AllOf(Gt(30U), Lt(70U))))) << "Animated missiles should rotate either direction roughly 50% of the time"; } TEST(Missiles, RotateBlockedMissileArrow)