Do not count dead NPCs as observers (Fixes #3434)

pull/1/head
scrawl 9 years ago
parent 12eea9ed69
commit 165f048792

@ -1144,14 +1144,19 @@ namespace MWMechanics
for (PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) for (PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{ {
MWWorld::Ptr observer = iter->first;
if (iter->first == player) // not the player if (iter->first == player) // not the player
continue; continue;
if (observer.getClass().getCreatureStats(observer).isDead())
continue;
// is the player in range and can they be detected // is the player in range and can they be detected
if ((iter->first.getRefData().getPosition().asVec3() - player.getRefData().getPosition().asVec3()).length2() <= radius*radius if ((observer.getRefData().getPosition().asVec3() - player.getRefData().getPosition().asVec3()).length2() <= radius*radius
&& MWBase::Environment::get().getWorld()->getLOS(player, iter->first)) && 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; detected = true;
avoidedNotice = false; avoidedNotice = false;

Loading…
Cancel
Save