From a6ee4272aa890d6b721088a077c44e19370456ce Mon Sep 17 00:00:00 2001 From: mrcheko Date: Sun, 15 Jun 2014 00:14:18 +0400 Subject: [PATCH] fix bug when you were able to kill somebody from large distance without being spotted --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 7178a2556b..2fa12bc452 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -853,8 +853,15 @@ namespace MWMechanics // Find all the actors within the alarm radius std::vector neighbors; - mActors.getObjectsInRange(Ogre::Vector3(player.getRefData().getPosition().pos), - esmStore.get().find("fAlarmRadius")->getInt(), neighbors); + + Ogre::Vector3 from = Ogre::Vector3(player.getRefData().getPosition().pos); + int radius = esmStore.get().find("fAlarmRadius")->getInt(); + + mActors.getObjectsInRange(from, radius, neighbors); + + // victim should be considered even beyond alarm radius + if (from.squaredDistance(Ogre::Vector3(victim.getRefData().getPosition().pos)) > radius*radius) + neighbors.push_back(victim); int id = MWBase::Environment::get().getWorld()->getPlayer().getNewCrimeId();