From b09e6644a970cb63a5828eab59329116e2237a59 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 16 Apr 2017 20:26:06 +0300 Subject: [PATCH] [Client] Prevent infinite guard arrest loops --- apps/openmw/mwmechanics/aipursue.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 2b218de03..817a5b41d 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -8,6 +8,16 @@ #include "../mwworld/class.hpp" #include "../mwworld/action.hpp" +/* + Start of tes3mp addition + + Include additional headers for multiplayer purposes +*/ +#include "../mwgui/windowmanagerimp.hpp" +/* + End of tes3mp addition +*/ + #include "movement.hpp" #include "creaturestats.hpp" @@ -46,11 +56,29 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte if(target.getClass().getCreatureStats(target).isDead()) return true; + /* + Start of tes3mp addition + + Because multiplayer does not pause the game, prevent infinite arrest loops by ignoring + players already engaged in dialogue + */ + if (target == MWBase::Environment::get().getWorld()->getPlayerPtr()) + { + if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue)) + { + return true; + } + } + /* + End of tes3mp addition + */ + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); //Set the target desition from the actor ESM::Pathgrid::Point dest = target.getRefData().getPosition().pos; + if (pathTo(actor, dest, duration, 100)) { target.getClass().activate(target,actor).get()->execute(actor); //Arrest player when reached return true;