From 332ceb51a25c40caba4444174216794652094be8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 10 Feb 2017 06:48:03 +0100 Subject: [PATCH] Rearranged check for better performance --- apps/openmw/mwmechanics/actors.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 418f53422..9376beb2d 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -300,6 +300,10 @@ namespace MWMechanics if (!actor1.getClass().isMobile(actor1)) return; + // Stop here if target is unreachable + if (!MWMechanics::canFight(actor1, actor2)) + return; + // If this is set to true, actor1 will start combat with actor2 if the awareness check at the end of the method returns true bool aggressive = false; @@ -375,10 +379,6 @@ namespace MWMechanics } } - // Stop here if target is unreachable - if (!MWMechanics::canFight(actor1, actor2)) - return; - // Do aggression check if actor2 is the player or a player follower or escorter if (!aggressive) {