1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 10:36:42 +00:00

replaced FLT_MAX with numeric_limits.

This commit is contained in:
dteviot 2015-08-21 19:34:28 +12:00
parent 3b231b85bb
commit 85bc41dedb
6 changed files with 10 additions and 10 deletions

View file

@ -806,7 +806,7 @@ namespace MWMechanics
void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos) void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos)
{ {
float distanceToClosestNode = FLT_MAX; float distanceToClosestNode = std::numeric_limits<float>::max();
unsigned int index = 0; unsigned int index = 0;
for (unsigned int counterThree = 0; counterThree < mAllowedNodes.size(); counterThree++) for (unsigned int counterThree = 0; counterThree < mAllowedNodes.size(); counterThree++)
{ {

View file

@ -181,7 +181,7 @@ namespace MWMechanics
void calcWeakestSchool (const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm) void calcWeakestSchool (const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm)
{ {
float minChance = FLT_MAX; float minChance = std::numeric_limits<float>::max();
const ESM::EffectList& effects = spell->mEffects; const ESM::EffectList& effects = spell->mEffects;
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it) for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it)

View file

@ -53,8 +53,8 @@ namespace
{ {
assert(grid && !grid->mPoints.empty()); assert(grid && !grid->mPoints.empty());
float closestDistanceBetween = FLT_MAX; float closestDistanceBetween = std::numeric_limits<float>::max();
float closestDistanceReachable = FLT_MAX; float closestDistanceReachable = std::numeric_limits<float>::max();
int closestIndex = 0; int closestIndex = 0;
int closestReachableIndex = 0; int closestReachableIndex = 0;
// TODO: if this full scan causes performance problems mapping pathgrid // 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)); assert(cell->isPointConnected(start, closestReachableIndex));
// AiWander has logic that depends on whether a path was created, deleting // AiWander has logic that depends on whether a path was created, deleting

View file

@ -92,7 +92,7 @@ namespace MWMechanics
if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude()) if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude())
return 0; return 0;
float y = FLT_MAX; float y = std::numeric_limits<float>::max();
float lowestSkill = 0; float lowestSkill = 0;
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != spell->mEffects.mList.end(); ++it) for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != spell->mEffects.mList.end(); ++it)

View file

@ -383,7 +383,7 @@ namespace MWRender
if (mFogDepth == 0.f) if (mFogDepth == 0.f)
{ {
mStateUpdater->setFogStart(0.f); mStateUpdater->setFogStart(0.f);
mStateUpdater->setFogEnd(FLT_MAX); mStateUpdater->setFogEnd(std::numeric_limits<float>::max());
} }
else else
{ {

View file

@ -2659,8 +2659,8 @@ namespace MWWorld
MWRender::RenderingManager::RayResult result2 = mRendering->castRay(origin, dest, true, true); MWRender::RenderingManager::RayResult result2 = mRendering->castRay(origin, dest, true, true);
float dist1 = FLT_MAX; float dist1 = std::numeric_limits<float>::max();
float dist2 = FLT_MAX; float dist2 = std::numeric_limits<float>::max();
if (result1.mHit) if (result1.mHit)
dist1 = (origin - result1.mHitPos).length(); 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 World::getClosestMarkerFromExteriorPosition( const osg::Vec3f& worldPos, const std::string &id ) {
MWWorld::Ptr closestMarker; MWWorld::Ptr closestMarker;
float closestDistance = FLT_MAX; float closestDistance = std::numeric_limits<float>::max();
std::vector<MWWorld::Ptr> markers; std::vector<MWWorld::Ptr> markers;
mCells.getExteriorPtrs(id, markers); mCells.getExteriorPtrs(id, markers);