diff --git a/apps/openmw_test_suite/detournavigator/asyncnavmeshupdater.cpp b/apps/openmw_test_suite/detournavigator/asyncnavmeshupdater.cpp index 71a833cc26..692b82ef96 100644 --- a/apps/openmw_test_suite/detournavigator/asyncnavmeshupdater.cpp +++ b/apps/openmw_test_suite/detournavigator/asyncnavmeshupdater.cpp @@ -78,7 +78,7 @@ namespace const std::map changedTiles {{TilePosition {0, 0}, ChangeType::add}}; updater.post(mAgentBounds, navMeshCacheItem, mPlayerTile, mWorldspace, changedTiles); updater.wait(mListener, WaitConditionType::allJobsDone); - EXPECT_NE(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0); + EXPECT_NE(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0u); } TEST_F(DetourNavigatorAsyncNavMeshUpdaterTest, repeated_post_should_lead_to_cache_hit) @@ -150,7 +150,7 @@ namespace serialize(mSettings.mRecast, mAgentBounds, *recastMesh, objects)); ASSERT_TRUE(tile.has_value()); EXPECT_EQ(tile->mTileId, 1); - EXPECT_EQ(tile->mVersion, navMeshVersion); + EXPECT_EQ(tile->mVersion, navMeshFormatVersion); } TEST_F(DetourNavigatorAsyncNavMeshUpdaterTest, post_when_writing_to_db_disabled_should_not_write_tiles) @@ -240,12 +240,12 @@ namespace const std::map changedTilesAdd {{TilePosition {0, 0}, ChangeType::add}}; updater.post(mAgentBounds, navMeshCacheItem, mPlayerTile, mWorldspace, changedTilesAdd); updater.wait(mListener, WaitConditionType::allJobsDone); - ASSERT_NE(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0); + ASSERT_NE(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0u); const std::map changedTilesRemove {{TilePosition {0, 0}, ChangeType::remove}}; const TilePosition playerTile(100, 100); updater.post(mAgentBounds, navMeshCacheItem, playerTile, mWorldspace, changedTilesRemove); updater.wait(mListener, WaitConditionType::allJobsDone); - EXPECT_EQ(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0); + EXPECT_EQ(navMeshCacheItem->lockConst()->getImpl().getTileRefAt(0, 0, 0), 0u); } TEST_F(DetourNavigatorAsyncNavMeshUpdaterTest, should_stop_writing_to_db_when_size_limit_is_reached) diff --git a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp index b86fe7616b..dcdca1ee72 100644 --- a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp +++ b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp @@ -338,10 +338,10 @@ namespace AreaType_ground, mSource, mObjectTransform ); const auto recastMesh = std::move(builder).create(mGeneration, mRevision); - EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector({ - 0, -4.24264049530029296875, 4.44089209850062616169452667236328125e-16, - 0, -3.535533905029296875, -0.707106769084930419921875, - 0, -3.535533905029296875, 0.707106769084930419921875, + EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ + 0, -4.24264049530029296875f, 4.44089209850062616169452667236328125e-16f, + 0, -3.535533905029296875f, -0.707106769084930419921875f, + 0, -3.535533905029296875f, 0.707106769084930419921875f, }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({1, 2, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -363,10 +363,10 @@ namespace AreaType_ground, mSource, mObjectTransform ); const auto recastMesh = std::move(builder).create(mGeneration, mRevision); - EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector({ - -4.24264049530029296875, 0, 4.44089209850062616169452667236328125e-16, - -3.535533905029296875, 0, -0.707106769084930419921875, - -3.535533905029296875, 0, 0.707106769084930419921875, + EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ + -4.24264049530029296875f, 0, 4.44089209850062616169452667236328125e-16f, + -3.535533905029296875f, 0, -0.707106769084930419921875f, + -3.535533905029296875f, 0, 0.707106769084930419921875f, }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({1, 2, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -388,10 +388,10 @@ namespace AreaType_ground, mSource, mObjectTransform ); const auto recastMesh = std::move(builder).create(mGeneration, mRevision); - EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector({ - -1.41421353816986083984375, -1.1102230246251565404236316680908203125e-16, 0, - 1.1102230246251565404236316680908203125e-16, -1.41421353816986083984375, 0, - 1.41421353816986083984375, 1.1102230246251565404236316680908203125e-16, 0, + EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ + -1.41421353816986083984375f, -1.1102230246251565404236316680908203125e-16f, 0, + 1.1102230246251565404236316680908203125e-16f, -1.41421353816986083984375f, 0, + 1.41421353816986083984375f, 1.1102230246251565404236316680908203125e-16f, 0, }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 0, 1})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); diff --git a/apps/openmw_test_suite/lua/test_configuration.cpp b/apps/openmw_test_suite/lua/test_configuration.cpp index 7170f33849..39c4f06201 100644 --- a/apps/openmw_test_suite/lua/test_configuration.cpp +++ b/apps/openmw_test_suite/lua/test_configuration.cpp @@ -236,7 +236,7 @@ namespace { sol::table data = LuaUtil::deserialize(lua.lua_state(), loadedCfg.mScripts[1].mRefs[1].mInitializationData, &serializer); ESM::RefNum adjustedRef = data["fargoth"].get(); - EXPECT_EQ(adjustedRef.mIndex, 128964); + EXPECT_EQ(adjustedRef.mIndex, 128964u); EXPECT_EQ(adjustedRef.mContentFile, 2); } } diff --git a/apps/openmw_test_suite/lua/test_serialization.cpp b/apps/openmw_test_suite/lua/test_serialization.cpp index 610d5b43c1..a74081266f 100644 --- a/apps/openmw_test_suite/lua/test_serialization.cpp +++ b/apps/openmw_test_suite/lua/test_serialization.cpp @@ -33,7 +33,7 @@ namespace EXPECT_EQ(serialized.size(), 10); // version, type, 8 bytes value sol::object value = LuaUtil::deserialize(lua, serialized); ASSERT_TRUE(value.is()); - EXPECT_FLOAT_EQ(value.as(), 3.14); + EXPECT_DOUBLE_EQ(value.as(), 3.14); } TEST(LuaSerializationTest, Boolean) @@ -183,7 +183,7 @@ namespace EXPECT_EQ(t.get("ab"), true); EXPECT_EQ(t.get("nested").get("aa"), 2); EXPECT_EQ(t.get("nested").get("bb"), "something"); - EXPECT_FLOAT_EQ(t.get("nested").get(5), -0.5); + EXPECT_DOUBLE_EQ(t.get("nested").get(5), -0.5); EXPECT_EQ(t.get(1), osg::Vec2f(1, 2)); EXPECT_EQ(t.get(2), osg::Vec2f(2, 1)); } diff --git a/apps/openmw_test_suite/lua/test_utilpackage.cpp b/apps/openmw_test_suite/lua/test_utilpackage.cpp index b7aa534c1d..2e8734a2df 100644 --- a/apps/openmw_test_suite/lua/test_utilpackage.cpp +++ b/apps/openmw_test_suite/lua/test_utilpackage.cpp @@ -172,12 +172,12 @@ namespace lua.open_libraries(sol::lib::base, sol::lib::math, sol::lib::string); lua["util"] = LuaUtil::initUtilPackage(lua); lua.safe_script("v = util.vector2(1, 0):rotate(math.rad(120))"); - EXPECT_FLOAT_EQ(get(lua, "v.x"), -0.5); - EXPECT_FLOAT_EQ(get(lua, "v.y"), 0.86602539); - EXPECT_FLOAT_EQ(get(lua, "util.normalizeAngle(math.pi * 10 + 0.1)"), 0.1); - EXPECT_FLOAT_EQ(get(lua, "util.clamp(0.1, 0, 1.5)"), 0.1); + EXPECT_FLOAT_EQ(get(lua, "v.x"), -0.5f); + EXPECT_FLOAT_EQ(get(lua, "v.y"), 0.86602539f); + EXPECT_FLOAT_EQ(get(lua, "util.normalizeAngle(math.pi * 10 + 0.1)"), 0.1f); + EXPECT_FLOAT_EQ(get(lua, "util.clamp(0.1, 0, 1.5)"), 0.1f); EXPECT_FLOAT_EQ(get(lua, "util.clamp(-0.1, 0, 1.5)"), 0); - EXPECT_FLOAT_EQ(get(lua, "util.clamp(2.1, 0, 1.5)"), 1.5); + EXPECT_FLOAT_EQ(get(lua, "util.clamp(2.1, 0, 1.5)"), 1.5f); lua.safe_script("t = util.makeReadOnly({x = 1})"); EXPECT_FLOAT_EQ(get(lua, "t.x"), 1); EXPECT_ERROR(lua.safe_script("t.y = 2"), "userdata value"); diff --git a/apps/openmw_test_suite/misc/test_endianness.cpp b/apps/openmw_test_suite/misc/test_endianness.cpp index 240e4a49ac..9c3bbf61a6 100644 --- a/apps/openmw_test_suite/misc/test_endianness.cpp +++ b/apps/openmw_test_suite/misc/test_endianness.cpp @@ -31,24 +31,24 @@ TEST_F(EndiannessTest, test_swap_endianness_inplace2) uint16_t fortytwo = 0x0042; Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x0000); + EXPECT_EQ(zero, 0x0000u); Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x0000); + EXPECT_EQ(zero, 0x0000u); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFF); + EXPECT_EQ(ffff, 0xFFFFu); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFF); + EXPECT_EQ(ffff, 0xFFFFu); Misc::swapEndiannessInplace(n12); - EXPECT_EQ(n12, 0x0201); + EXPECT_EQ(n12, 0x0201u); Misc::swapEndiannessInplace(n12); - EXPECT_EQ(n12, 0x0102); + EXPECT_EQ(n12, 0x0102u); Misc::swapEndiannessInplace(fortytwo); - EXPECT_EQ(fortytwo, 0x4200); + EXPECT_EQ(fortytwo, 0x4200u); Misc::swapEndiannessInplace(fortytwo); - EXPECT_EQ(fortytwo, 0x0042); + EXPECT_EQ(fortytwo, 0x0042u); } TEST_F(EndiannessTest, test_swap_endianness_inplace4) @@ -58,19 +58,19 @@ TEST_F(EndiannessTest, test_swap_endianness_inplace4) uint32_t ffff = 0xFFFFFFFF; Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x00000000); + EXPECT_EQ(zero, 0x00000000u); Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x00000000); + EXPECT_EQ(zero, 0x00000000u); Misc::swapEndiannessInplace(n1234); - EXPECT_EQ(n1234, 0x04030201); + EXPECT_EQ(n1234, 0x04030201u); Misc::swapEndiannessInplace(n1234); - EXPECT_EQ(n1234, 0x01020304); + EXPECT_EQ(n1234, 0x01020304u); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFFFFFF); + EXPECT_EQ(ffff, 0xFFFFFFFFu); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFFFFFF); + EXPECT_EQ(ffff, 0xFFFFFFFFu); } TEST_F(EndiannessTest, test_swap_endianness_inplace8) @@ -80,19 +80,19 @@ TEST_F(EndiannessTest, test_swap_endianness_inplace8) uint64_t ffff = 0xFFFF'FFFF'FFFF'FFFF; Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x0000'0000'0000'0000); + EXPECT_EQ(zero, 0x0000'0000'0000'0000u); Misc::swapEndiannessInplace(zero); - EXPECT_EQ(zero, 0x0000'0000'0000'0000); + EXPECT_EQ(zero, 0x0000'0000'0000'0000u); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFF'FFFF'FFFF'FFFF); + EXPECT_EQ(ffff, 0xFFFF'FFFF'FFFF'FFFFu); Misc::swapEndiannessInplace(ffff); - EXPECT_EQ(ffff, 0xFFFF'FFFF'FFFF'FFFF); + EXPECT_EQ(ffff, 0xFFFF'FFFF'FFFF'FFFFu); Misc::swapEndiannessInplace(n1234); - EXPECT_EQ(n1234, 0x0807'0605'0403'0201); + EXPECT_EQ(n1234, 0x0807'0605'0403'0201u); Misc::swapEndiannessInplace(n1234); - EXPECT_EQ(n1234, 0x0102'0304'0506'0708); + EXPECT_EQ(n1234, 0x0102'0304'0506'0708u); } TEST_F(EndiannessTest, test_swap_endianness_inplace_float) diff --git a/apps/openmw_test_suite/serialization/binaryreader.cpp b/apps/openmw_test_suite/serialization/binaryreader.cpp index 071cfabb8f..b78c673d8f 100644 --- a/apps/openmw_test_suite/serialization/binaryreader.cpp +++ b/apps/openmw_test_suite/serialization/binaryreader.cpp @@ -24,7 +24,7 @@ namespace std::uint32_t result = 0; const TestFormat format; binaryReader(format, result); - EXPECT_EQ(result, 42); + EXPECT_EQ(result, 42u); } TEST(DetourNavigatorSerializationBinaryReaderTest, shouldReadArithmeticTypeRangeValue) diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index e6b07d3f36..ee6cf453b8 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -92,7 +92,7 @@ namespace DetourNavigator { if (db == nullptr) return nullptr; - return std::make_unique(updater, std::move(db), TileVersion(navMeshVersion), + return std::make_unique(updater, std::move(db), TileVersion(navMeshFormatVersion), settings.mRecast, settings.mWriteToNavMeshDb); } @@ -483,7 +483,7 @@ namespace DetourNavigator std::unique_ptr preparedNavMeshData; bool generatedNavMeshData = false; - if (job.mCachedTileData.has_value() && job.mCachedTileData->mVersion == navMeshVersion) + if (job.mCachedTileData.has_value() && job.mCachedTileData->mVersion == navMeshFormatVersion) { preparedNavMeshData = std::make_unique(); if (deserialize(job.mCachedTileData->mData, *preparedNavMeshData)) diff --git a/components/detournavigator/generatenavmeshtile.cpp b/components/detournavigator/generatenavmeshtile.cpp index 41b60d4a75..2beb9d6468 100644 --- a/components/detournavigator/generatenavmeshtile.cpp +++ b/components/detournavigator/generatenavmeshtile.cpp @@ -73,7 +73,7 @@ namespace DetourNavigator std::vector input = serialize(mSettings.mRecast, mAgentBounds, *recastMesh, objects); const std::optional info = consumer->find(mWorldspace, mTilePosition, input); - if (info.has_value() && info->mVersion == navMeshVersion) + if (info.has_value() && info->mVersion == navMeshFormatVersion) { consumer->identity(mWorldspace, mTilePosition, info->mTileId); ignore.mConsumer = nullptr; @@ -86,9 +86,9 @@ namespace DetourNavigator return; if (info.has_value()) - consumer->update(mWorldspace, mTilePosition, info->mTileId, navMeshVersion, *data); + consumer->update(mWorldspace, mTilePosition, info->mTileId, navMeshFormatVersion, *data); else - consumer->insert(mWorldspace, mTilePosition, navMeshVersion, input, *data); + consumer->insert(mWorldspace, mTilePosition, navMeshFormatVersion, input, *data); ignore.mConsumer = nullptr; } diff --git a/components/detournavigator/settings.hpp b/components/detournavigator/settings.hpp index 67e0a5a958..45bcf15dbf 100644 --- a/components/detournavigator/settings.hpp +++ b/components/detournavigator/settings.hpp @@ -53,7 +53,7 @@ namespace DetourNavigator std::uint64_t mMaxDbFileSize = 0; }; - inline constexpr std::int64_t navMeshVersion = 2; + inline constexpr std::int64_t navMeshFormatVersion = 2; RecastSettings makeRecastSettingsFromSettingsManager(); diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index be9890750f..494332005a 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -128,11 +128,11 @@ void ConfigurationManager::readConfiguration(bpo::variables_map& variables, auto composingVariables = separateComposingVariables(variables, description); for (auto& [k, v] : *it) { - auto it = variables.find(k); - if (it == variables.end()) + auto variable = variables.find(k); + if (variable == variables.end()) variables.insert({k, v}); - else if (it->second.defaulted()) - it->second = v; + else if (variable->second.defaulted()) + variable->second = v; } mergeComposingVariables(variables, composingVariables, description); } diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 071541c196..b2beead8bd 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -71,7 +71,8 @@ KeyframeController::KeyframeController() } KeyframeController::KeyframeController(const KeyframeController ©, const osg::CopyOp ©op) - : SceneUtil::KeyframeController(copy, copyop) + : osg::Object(copy, copyop) + , SceneUtil::KeyframeController(copy) , SceneUtil::NodeCallback(copy, copyop) , mRotations(copy.mRotations) , mXRotations(copy.mXRotations) diff --git a/components/sceneutil/keyframe.hpp b/components/sceneutil/keyframe.hpp index 59a87ab08e..eee8d6646c 100644 --- a/components/sceneutil/keyframe.hpp +++ b/components/sceneutil/keyframe.hpp @@ -17,9 +17,8 @@ namespace SceneUtil public: KeyframeController() {} - KeyframeController(const KeyframeController& copy, const osg::CopyOp& copyop) - : osg::Object(copy, copyop) - , SceneUtil::Controller(copy) {} + KeyframeController(const KeyframeController& copy) + : SceneUtil::Controller(copy) {} virtual osg::Vec3f getTranslation(float time) const { return osg::Vec3f(); } diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index 4d0f7a460a..0f9cf4ce6e 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -68,8 +68,11 @@ namespace SceneUtil traverse( node ); } - OsgAnimationController::OsgAnimationController(const OsgAnimationController ©, const osg::CopyOp ©op) : SceneUtil::KeyframeController(copy, copyop), SceneUtil::NodeCallback(copy, copyop) - , mEmulatedAnimations(copy.mEmulatedAnimations) + OsgAnimationController::OsgAnimationController(const OsgAnimationController ©, const osg::CopyOp ©op) + : osg::Object(copy, copyop) + , SceneUtil::KeyframeController(copy) + , SceneUtil::NodeCallback(copy, copyop) + , mEmulatedAnimations(copy.mEmulatedAnimations) { mLinker = nullptr; for (const auto& mergedAnimationTrack : copy.mMergedAnimationTracks)