Browse Source

Fix a few MSVC warnings (#6782)

pull/6783/head
obligaron 2 years ago committed by GitHub
parent
commit
9bf1fd48b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Source/levels/drlg_l4.cpp
  2. 2
      Source/portal.cpp
  3. 2
      Source/utils/soundsample.cpp
  4. 6
      test/missiles_test.cpp

2
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];
}
}

2
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<int>(setlvlnum) : currlevel)
if (Portals[i].setlvl == setlevel && Portals[i].level == (setlevel ? static_cast<int>(setlvlnum) : currlevel))
return true;
return leveltype == DTYPE_TOWN;

2
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.

6
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<int, unsigned> 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)

Loading…
Cancel
Save