From 165f048792183e26166a78f13205371103abaae9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 7 Jun 2016 22:01:44 +0200 Subject: [PATCH] Do not count dead NPCs as observers (Fixes #3434) --- apps/openmw/mwmechanics/actors.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index ecda432a7..38611374f 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1144,14 +1144,19 @@ namespace MWMechanics for (PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) { + MWWorld::Ptr observer = iter->first; + if (iter->first == player) // not the player continue; + if (observer.getClass().getCreatureStats(observer).isDead()) + continue; + // is the player in range and can they be detected - if ((iter->first.getRefData().getPosition().asVec3() - player.getRefData().getPosition().asVec3()).length2() <= radius*radius - && MWBase::Environment::get().getWorld()->getLOS(player, iter->first)) + if ((observer.getRefData().getPosition().asVec3() - player.getRefData().getPosition().asVec3()).length2() <= radius*radius + && MWBase::Environment::get().getWorld()->getLOS(player, observer)) { - if (MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, iter->first)) + if (MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, observer)) { detected = true; avoidedNotice = false;