From 312dc84fa4743f3a8b40725d6afa4e6b1edb0d94 Mon Sep 17 00:00:00 2001
From: scrawl <scrawl@baseoftrash.de>
Date: Thu, 8 May 2014 20:40:45 +0200
Subject: [PATCH] Fix a bug where the player's inventory could be opened as a
 container

If an NPC uses AiActivate on the player (i.e. to activate dialogue) precisely in the frame where the player just died, the player's inventory would be opened as a container instead.
---
 apps/openmw/mwclass/npc.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp
index 6a96c955f..b548e0844 100644
--- a/apps/openmw/mwclass/npc.cpp
+++ b/apps/openmw/mwclass/npc.cpp
@@ -797,6 +797,10 @@ namespace MWClass
     boost::shared_ptr<MWWorld::Action> Npc::activate (const MWWorld::Ptr& ptr,
         const MWWorld::Ptr& actor) const
     {
+        // player got activated by another NPC
+        if(ptr.getRefData().getHandle() == "player")
+            return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
+
         if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
         {
             const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
@@ -814,10 +818,6 @@ namespace MWClass
         if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak))
             return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr)); // stealing
         
-        // player got activated by another NPC
-        if(ptr.getRefData().getHandle() == "player")
-            return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
-
         return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(ptr));
 
     }