From 85bc41dedb9db07da2c4609ea39be95b508bb5e2 Mon Sep 17 00:00:00 2001 From: dteviot Date: Fri, 21 Aug 2015 19:34:28 +1200 Subject: [PATCH] replaced FLT_MAX with numeric_limits. --- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwmechanics/autocalcspell.cpp | 2 +- apps/openmw/mwmechanics/pathfinding.cpp | 6 +++--- apps/openmw/mwmechanics/spellcasting.cpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index afe34218e..7b846cb97 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -806,7 +806,7 @@ namespace MWMechanics void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos) { - float distanceToClosestNode = FLT_MAX; + float distanceToClosestNode = std::numeric_limits::max(); unsigned int index = 0; for (unsigned int counterThree = 0; counterThree < mAllowedNodes.size(); counterThree++) { diff --git a/apps/openmw/mwmechanics/autocalcspell.cpp b/apps/openmw/mwmechanics/autocalcspell.cpp index e4b143826..5dfe388a8 100644 --- a/apps/openmw/mwmechanics/autocalcspell.cpp +++ b/apps/openmw/mwmechanics/autocalcspell.cpp @@ -181,7 +181,7 @@ namespace MWMechanics void calcWeakestSchool (const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm) { - float minChance = FLT_MAX; + float minChance = std::numeric_limits::max(); const ESM::EffectList& effects = spell->mEffects; for (std::vector::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it) diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index 9c9c11106..f40624ae8 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -53,8 +53,8 @@ namespace { assert(grid && !grid->mPoints.empty()); - float closestDistanceBetween = FLT_MAX; - float closestDistanceReachable = FLT_MAX; + float closestDistanceBetween = std::numeric_limits::max(); + float closestDistanceReachable = std::numeric_limits::max(); int closestIndex = 0; int closestReachableIndex = 0; // TODO: if this full scan causes performance problems mapping pathgrid @@ -78,7 +78,7 @@ namespace } } - // invariant: start and endpoint must be connected + // post-condition: start and endpoint must be connected assert(cell->isPointConnected(start, closestReachableIndex)); // AiWander has logic that depends on whether a path was created, deleting diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index b98bf9f96..59410001f 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -92,7 +92,7 @@ namespace MWMechanics if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude()) return 0; - float y = FLT_MAX; + float y = std::numeric_limits::max(); float lowestSkill = 0; for (std::vector::const_iterator it = spell->mEffects.mList.begin(); it != spell->mEffects.mList.end(); ++it) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index bac8fca6c..1a1b04d18 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -383,7 +383,7 @@ namespace MWRender if (mFogDepth == 0.f) { mStateUpdater->setFogStart(0.f); - mStateUpdater->setFogEnd(FLT_MAX); + mStateUpdater->setFogEnd(std::numeric_limits::max()); } else { diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 1eed841bd..36f275cf4 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2659,8 +2659,8 @@ namespace MWWorld MWRender::RenderingManager::RayResult result2 = mRendering->castRay(origin, dest, true, true); - float dist1 = FLT_MAX; - float dist2 = FLT_MAX; + float dist1 = std::numeric_limits::max(); + float dist2 = std::numeric_limits::max(); if (result1.mHit) dist1 = (origin - result1.mHitPos).length(); @@ -2853,7 +2853,7 @@ namespace MWWorld MWWorld::Ptr World::getClosestMarkerFromExteriorPosition( const osg::Vec3f& worldPos, const std::string &id ) { MWWorld::Ptr closestMarker; - float closestDistance = FLT_MAX; + float closestDistance = std::numeric_limits::max(); std::vector markers; mCells.getExteriorPtrs(id, markers);