From 5a00b239accf24367860e2217918c861ce9532de Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:35:27 +0900 Subject: [PATCH] Reduce scope of variables --- apps/openmw/mwmechanics/aicombat.cpp | 6 ++++-- apps/openmw/mwrender/animation.cpp | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 17005f235..d111eb127 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -500,8 +500,7 @@ namespace MWMechanics { // get the range of the target's weapon float rangeAttackOfTarget = 0.f; - bool isRangedCombat = false; - MWWorld::Ptr targetWeapon = MWWorld::Ptr(); + MWWorld::Ptr targetWeapon = MWWorld::Ptr(); const MWWorld::Class& targetClass = target.getClass(); if (targetClass.hasInventoryStore(target)) @@ -516,7 +515,10 @@ namespace MWMechanics boost::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); if (targetWeaponAction.get()) + { + bool isRangedCombat = false; rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat); + } // apply sideway movement (kind of dodging) with some probability // if actor is within range of target's weapon diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index ba4307c89..fe20ac437 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1058,11 +1058,9 @@ namespace MWRender float timepassed = duration * state.mSpeedMult; while(state.mPlaying) { - float targetTime; - if (!state.shouldLoop()) { - targetTime = state.getTime() + timepassed; + float targetTime = state.getTime() + timepassed; if(textkey == textkeys.end() || textkey->first > targetTime) { if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr())