1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-25 16:43:33 +00:00

Merge pull request #3191 from akortunov/warnfix

Fix some MSVC warnings
This commit is contained in:
Bret Curtis 2021-10-25 15:17:05 +02:00 committed by GitHub
commit 3d0da9b9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 19 deletions

View File

@ -82,7 +82,7 @@ namespace MWClass
const Creature::GMST& Creature::getGmst() const Creature::GMST& Creature::getGmst()
{ {
static const GMST gmst = [] static const GMST staticGmst = []
{ {
GMST gmst; GMST gmst;
@ -105,7 +105,7 @@ namespace MWClass
return gmst; return gmst;
} (); } ();
return gmst; return staticGmst;
} }
void Creature::ensureCustomData (const MWWorld::Ptr& ptr) const void Creature::ensureCustomData (const MWWorld::Ptr& ptr) const

View File

@ -266,7 +266,7 @@ namespace MWClass
const Npc::GMST& Npc::getGmst() const Npc::GMST& Npc::getGmst()
{ {
static const GMST gmst = [] static const GMST staticGmst = []
{ {
GMST gmst; GMST gmst;
@ -296,7 +296,7 @@ namespace MWClass
return gmst; return gmst;
} (); } ();
return gmst; return staticGmst;
} }
void Npc::ensureCustomData (const MWWorld::Ptr& ptr) const void Npc::ensureCustomData (const MWWorld::Ptr& ptr) const

View File

@ -526,10 +526,10 @@ namespace MWPhysics
void PhysicsSystem::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated) void PhysicsSystem::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated)
{ {
if (auto found = mObjects.find(old.mRef); found != mObjects.end()) if (auto foundObject = mObjects.find(old.mRef); foundObject != mObjects.end())
found->second->updatePtr(updated); foundObject->second->updatePtr(updated);
else if (auto found = mActors.find(old.mRef); found != mActors.end()) else if (auto foundActor = mActors.find(old.mRef); foundActor != mActors.end())
found->second->updatePtr(updated); foundActor->second->updatePtr(updated);
for (auto& [_, actor] : mActors) for (auto& [_, actor] : mActors)
{ {

View File

@ -69,8 +69,8 @@ namespace DetourNavigator
if (const btCollisionShape* const avoidShape = shapes.mShapeInstance->getAvoidCollisionShape()) if (const btCollisionShape* const avoidShape = shapes.mShapeInstance->getAvoidCollisionShape())
{ {
const ObjectId avoidId(avoidShape); const ObjectId avoidId(avoidShape);
const CollisionShape collisionShape {shapes.mShapeInstance, *avoidShape}; const CollisionShape avoidCollisionShape {shapes.mShapeInstance, *avoidShape};
if (mNavMeshManager.updateObject(avoidId, collisionShape, transform, AreaType_null)) if (mNavMeshManager.updateObject(avoidId, avoidCollisionShape, transform, AreaType_null))
{ {
updateAvoidShapeId(id, avoidId); updateAvoidShapeId(id, avoidId);
result = true; result = true;

View File

@ -14,11 +14,11 @@ namespace DetourNavigator
constexpr auto makeTuple(const rcPolyMesh& v) noexcept constexpr auto makeTuple(const rcPolyMesh& v) noexcept
{ {
return std::tuple( return std::tuple(
Span(v.verts, getVertsLength(v)), Span(v.verts, static_cast<int>(getVertsLength(v))),
Span(v.polys, getPolysLength(v)), Span(v.polys, static_cast<int>(getPolysLength(v))),
Span(v.regs, getRegsLength(v)), Span(v.regs, static_cast<int>(getRegsLength(v))),
Span(v.flags, getFlagsLength(v)), Span(v.flags, static_cast<int>(getFlagsLength(v))),
Span(v.areas, getAreasLength(v)), Span(v.areas, static_cast<int>(getAreasLength(v))),
ArrayRef(v.bmin), ArrayRef(v.bmin),
ArrayRef(v.bmax), ArrayRef(v.bmax),
v.cs, v.cs,
@ -31,9 +31,9 @@ namespace DetourNavigator
constexpr auto makeTuple(const rcPolyMeshDetail& v) noexcept constexpr auto makeTuple(const rcPolyMeshDetail& v) noexcept
{ {
return std::tuple( return std::tuple(
Span(v.meshes, getMeshesLength(v)), Span(v.meshes, static_cast<int>(getMeshesLength(v))),
Span(v.verts, getVertsLength(v)), Span(v.verts, static_cast<int>(getVertsLength(v))),
Span(v.tris, getTrisLength(v)) Span(v.tris, static_cast<int>(getTrisLength(v)))
); );
} }

View File

@ -32,7 +32,7 @@ std::string ESM::loadLuaBinaryData(ESMReader& esm)
{ {
esm.getSubHeader(); esm.getSubHeader();
data.resize(esm.getSubSize()); data.resize(esm.getSubSize());
esm.getExact(data.data(), data.size()); esm.getExact(data.data(), static_cast<int>(data.size()));
} }
return data; return data;
} }