Merge remote-tracking branch 'dteviot/Bug2871'

sceneinput
Marc Zinnschlag 10 years ago
commit 50ec8b10f5

@ -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++)
{ {

@ -1,6 +1,7 @@
#include "autocalcspell.hpp" #include "autocalcspell.hpp"
#include <climits> #include <climits>
#include <limits>
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
@ -181,7 +182,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)

@ -1,4 +1,5 @@
#include "pathfinding.hpp" #include "pathfinding.hpp"
#include <limits>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -53,13 +54,13 @@ namespace
{ {
assert(grid && !grid->mPoints.empty()); assert(grid && !grid->mPoints.empty());
float closestDistanceBetween = distanceSquared(grid->mPoints[0], pos); float closestDistanceBetween = std::numeric_limits<float>::max();
float closestDistanceReachable = closestDistanceBetween; 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
// points to a quadtree may help // points to a quadtree may help
for(unsigned int counter = 1; counter < grid->mPoints.size(); counter++) for(unsigned int counter = 0; counter < grid->mPoints.size(); counter++)
{ {
float potentialDistBetween = distanceSquared(grid->mPoints[counter], pos); float potentialDistBetween = distanceSquared(grid->mPoints[counter], pos);
if (potentialDistBetween < closestDistanceReachable) if (potentialDistBetween < closestDistanceReachable)
@ -78,7 +79,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

@ -1,6 +1,7 @@
#include "spellcasting.hpp" #include "spellcasting.hpp"
#include <cfloat> #include <cfloat>
#include <limits>
#include <boost/format.hpp> #include <boost/format.hpp>
@ -92,7 +93,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)

@ -1,6 +1,7 @@
#include "renderingmanager.hpp" #include "renderingmanager.hpp"
#include <stdexcept> #include <stdexcept>
#include <limits>
#include <osg/Light> #include <osg/Light>
#include <osg/LightModel> #include <osg/LightModel>
@ -383,7 +384,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
{ {

@ -2654,8 +2654,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();
@ -2848,7 +2848,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);

Loading…
Cancel
Save