From f308dde254d8a14586b80ace0956f9f297c10a54 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 17 Apr 2021 10:53:47 +0400 Subject: [PATCH] Clean up MSVC warnings --- CMakeLists.txt | 4 ++-- apps/esmtool/esmtool.cpp | 2 +- apps/opencs/model/prefs/shortcutsetting.cpp | 2 -- apps/openmw/mwmechanics/aicombat.cpp | 7 ++----- apps/openmw/mwworld/esmstore.cpp | 4 ++-- components/misc/frameratelimiter.hpp | 2 +- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08bdbce8ae..efc405a45f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -585,8 +585,8 @@ if (WIN32) # Warnings that aren't enabled normally and don't need to be enabled # They're unneeded and sometimes completely retarded warnings that /Wall enables # Not going to bother commenting them as they tend to warn on every standard library file - 4061 4263 4264 4266 4350 4371 4435 4514 4548 4571 4610 4619 4623 4625 - 4626 4628 4640 4668 4710 4711 4768 4820 4826 4917 4946 5032 5039 5045 + 4061 4263 4264 4266 4350 4371 4435 4514 4548 4571 4582 4583 4610 4619 4623 4625 + 4626 4628 4640 4668 4710 4711 4768 4820 4826 4917 4946 5032 5039 5045 5219 5220 # Warnings that are thrown on standard libraries and not OpenMW 4347 # Non-template function with same name and parameter count as template function diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 7cea574c83..579f5f67d5 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -322,7 +322,7 @@ int load(Arguments& info) std::string filename = info.filename; std::cout << "Loading file: " << filename << std::endl; - std::list skipped; + std::list skipped; try { diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index 1c065f7da7..e0cd5bb07b 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -13,8 +13,6 @@ namespace CSMPrefs { - const int ShortcutSetting::MaxKeys; - ShortcutSetting::ShortcutSetting(Category* parent, Settings::Manager* values, QMutex* mutex, const std::string& key, const std::string& label) : Setting(parent, values, mutex, key, label) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 5edd59ded5..2e60965208 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -263,8 +263,9 @@ namespace MWMechanics && ((!storage.mReadyToAttack && !mPathFinder.isPathConstructed()) || (storage.mUseCustomDestination && (storage.mCustomDestination - vTargetPos).length() > rangeAttack))) { + const MWBase::World* world = MWBase::Environment::get().getWorld(); // Try to build path to the target. - const auto halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor); + const auto halfExtents = world->getPathfindingHalfExtents(actor); const auto navigatorFlags = getNavigatorFlags(actor); const auto areaCosts = getAreaCosts(actor); const auto pathGridGraph = getPathGridGraph(actor.getCell()); @@ -274,11 +275,7 @@ namespace MWMechanics { // If there is no path, try to find a point on a line from the actor position to target projected // on navmesh to attack the target from there. - const MWBase::World* world = MWBase::Environment::get().getWorld(); - const auto halfExtents = world->getPathfindingHalfExtents(actor); const auto navigator = world->getNavigator(); - const auto navigatorFlags = getNavigatorFlags(actor); - const auto areaCosts = getAreaCosts(actor); const auto hit = navigator->raycast(halfExtents, vActorPos, vTargetPos, navigatorFlags); if (hit.has_value() && (*hit - vTargetPos).length() <= rangeAttack) diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 986c4f8580..a69d74b052 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -63,9 +63,9 @@ namespace // We will replace invalid entries by fixed ones std::vector npcsToReplace; - for (auto it : npcs) + for (auto npcIter : npcs) { - ESM::NPC npc = it.second; + ESM::NPC npc = npcIter.second; bool changed = false; const std::string npcFaction = npc.mFaction; diff --git a/components/misc/frameratelimiter.hpp b/components/misc/frameratelimiter.hpp index b727074d26..e3689cbcf4 100644 --- a/components/misc/frameratelimiter.hpp +++ b/components/misc/frameratelimiter.hpp @@ -13,8 +13,8 @@ namespace Misc explicit FrameRateLimiter(std::chrono::duration maxFrameDuration, std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) : mMaxFrameDuration(std::chrono::duration_cast(maxFrameDuration)) - , mLastFrameDuration(0) , mLastMeasurement(now) + , mLastFrameDuration(0) {} std::chrono::steady_clock::duration getLastFrameDuration() const