From aba72258173db213bdccc82682ca1938a88d7559 Mon Sep 17 00:00:00 2001 From: dteviot Date: Sun, 26 Jul 2015 11:15:21 +1200 Subject: [PATCH] Removed some duplicated operations. --- apps/openmw/mwmechanics/aicombat.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 6a39178ce0..bdd09a1a8f 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -181,13 +181,15 @@ namespace MWMechanics // get or create temporary storage AiCombatStorage& storage = state.get(); + const MWWorld::Class& actorClass = actor.getClass(); //General description - if(actor.getClass().getCreatureStats(actor).isDead()) + if (actorClass.getCreatureStats(actor).isDead()) return true; - MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId); + MWBase::World* world = MWBase::Environment::get().getWorld(); + MWWorld::Ptr target = world->searchPtrViaActorId(mTargetActorId); if (target.isEmpty()) return false; @@ -196,9 +198,6 @@ namespace MWMechanics || target.getClass().getCreatureStats(target).isDead()) return true; - const MWWorld::Class& actorClass = actor.getClass(); - MWBase::World* world = MWBase::Environment::get().getWorld(); - //Update every frame bool& combatMove = storage.mCombatMove;