Merge pull request #1259 from Allofich/warnings

Fix a few Cppcheck warnings
pull/201/head
scrawl 8 years ago committed by GitHub
commit df3b4fe6a5

@ -500,8 +500,7 @@ namespace MWMechanics
{ {
// get the range of the target's weapon // get the range of the target's weapon
float rangeAttackOfTarget = 0.f; float rangeAttackOfTarget = 0.f;
bool isRangedCombat = false; MWWorld::Ptr targetWeapon = MWWorld::Ptr();
MWWorld::Ptr targetWeapon = MWWorld::Ptr();
const MWWorld::Class& targetClass = target.getClass(); const MWWorld::Class& targetClass = target.getClass();
if (targetClass.hasInventoryStore(target)) if (targetClass.hasInventoryStore(target))
@ -516,7 +515,10 @@ namespace MWMechanics
boost::shared_ptr<Action> targetWeaponAction (new ActionWeapon(targetWeapon)); boost::shared_ptr<Action> targetWeaponAction (new ActionWeapon(targetWeapon));
if (targetWeaponAction.get()) if (targetWeaponAction.get())
{
bool isRangedCombat = false;
rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat); rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat);
}
// apply sideway movement (kind of dodging) with some probability // apply sideway movement (kind of dodging) with some probability
// if actor is within range of target's weapon // if actor is within range of target's weapon

@ -171,10 +171,10 @@ void MWMechanics::Alchemy::updateEffects()
if (fPotionT1DurMult<=0) if (fPotionT1DurMult<=0)
throw std::runtime_error ("invalid gmst: fPotionT1DurMult"); throw std::runtime_error ("invalid gmst: fPotionT1DurMult");
float magnitude = magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude ? float magnitude = (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) ?
1 : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; 1.0f : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost;
float duration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? float duration = (magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) ?
1 : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; 1.0f : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost;
if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude))
applyTools (magicEffect->mData.mFlags, magnitude); applyTools (magicEffect->mData.mFlags, magnitude);

@ -230,13 +230,6 @@ namespace MWPhysics
return direction - project(direction, planeNormal); return direction - project(direction, planeNormal);
} }
static inline osg::Vec3f reflect(const osg::Vec3& velocity, const osg::Vec3f& normal)
{
return velocity - (normal * (normal * velocity)) * 2;
// ^ dot product
}
public: public:
static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, const osg::Vec3f& position, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight) static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, const osg::Vec3f& position, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight)
{ {

@ -211,7 +211,7 @@ namespace MWPhysics
float mTimeAccum; float mTimeAccum;
float mWaterHeight; float mWaterHeight;
float mWaterEnabled; bool mWaterEnabled;
std::auto_ptr<btCollisionObject> mWaterCollisionObject; std::auto_ptr<btCollisionObject> mWaterCollisionObject;
std::auto_ptr<btCollisionShape> mWaterCollisionShape; std::auto_ptr<btCollisionShape> mWaterCollisionShape;

@ -1058,11 +1058,9 @@ namespace MWRender
float timepassed = duration * state.mSpeedMult; float timepassed = duration * state.mSpeedMult;
while(state.mPlaying) while(state.mPlaying)
{ {
float targetTime;
if (!state.shouldLoop()) if (!state.shouldLoop())
{ {
targetTime = state.getTime() + timepassed; float targetTime = state.getTime() + timepassed;
if(textkey == textkeys.end() || textkey->first > targetTime) if(textkey == textkeys.end() || textkey->first > targetTime)
{ {
if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr()) if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr())

@ -538,13 +538,9 @@ namespace MWWorld
std::cout << "Changing to interior\n"; std::cout << "Changing to interior\n";
// unload // unload
int current = 0;
CellStoreCollection::iterator active = mActiveCells.begin(); CellStoreCollection::iterator active = mActiveCells.begin();
while (active!=mActiveCells.end()) while (active!=mActiveCells.end())
{
unloadCell (active++); unloadCell (active++);
++current;
}
int refsToLoad = cell->count(); int refsToLoad = cell->count();
loadingListener->setProgressRange(refsToLoad); loadingListener->setProgressRange(refsToLoad);

Loading…
Cancel
Save