From 03266d7648bd6545cc1503eba5f393cdbc87f922 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 25 Feb 2018 21:33:04 +0200 Subject: [PATCH] [Client] Prevent guards from arresting players who are currently jailed --- apps/openmw/mwgui/jailscreen.cpp | 24 +++++++++++++++++------- apps/openmw/mwmechanics/aipursue.cpp | 5 ++++- apps/openmw/mwmp/LocalPlayer.cpp | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 7267912ae..7b3d87a7c 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -112,6 +112,16 @@ namespace MWGui MWWorld::Ptr player = MWMechanics::getPlayer(); + /* + Start of tes3mp addition + + Declare pointer to LocalPlayer for use in other additions + */ + mwmp::LocalPlayer* localPlayer = mwmp::Main::get().getLocalPlayer(); + /* + End of tes3mp addition + */ + for (int i=0; irest(true); MWBase::Environment::get().getWorld()->advanceTime(mDays * 24); @@ -129,7 +139,7 @@ namespace MWGui Disable increases for Security and Sneak when using ignoreJailSkillIncreases */ - if (mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases) + if (localPlayer->ignoreJailSkillIncreases) value.setBase(std::max(0, value.getBase()-1)); else if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak) /* @@ -153,7 +163,7 @@ namespace MWGui If we've received a packet overriding the default jail end text, use the new text */ - if (!mwmp::Main::get().getLocalPlayer()->jailEndText.empty()) + if (!localPlayer->jailEndText.empty()) message = mwmp::Main::get().getLocalPlayer()->jailEndText; /* End of tes3mp addition @@ -176,7 +186,7 @@ namespace MWGui Account for usage of ignoreJailSkillIncreases */ - if (!mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases && + if (!localPlayer->ignoreJailSkillIncreases && (*it == ESM::Skill::Sneak || *it == ESM::Skill::Security)) /* End of tes3mp change (minor) @@ -195,10 +205,10 @@ namespace MWGui Reset all PlayerJail-related overrides */ - mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation = false; - mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases = false; - mwmp::Main::get().getLocalPlayer()->jailProgressText = ""; - mwmp::Main::get().getLocalPlayer()->jailEndText = ""; + localPlayer->ignoreJailTeleportation = false; + localPlayer->ignoreJailSkillIncreases = false; + localPlayer->jailProgressText = ""; + localPlayer->jailEndText = ""; /* End of tes3mp addition */ diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index c3aff89b8..ebe2d6f64 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -64,10 +64,13 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte Because multiplayer does not pause the game, prevent infinite arrest loops by ignoring players already engaged in dialogue + + Additionally, do not arrest players who are currently jailed */ if (target == MWBase::Environment::get().getWorld()->getPlayerPtr()) { - if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue)) + if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue) || + MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail)) { return true; } diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index c3c69108f..d9d0fc665 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -69,9 +69,9 @@ LocalPlayer::LocalPlayer() scale = 1; isWerewolf = false; - diedSinceArrestAttempt = false; isReceivingQuickKeys = false; isPlayingAnimation = false; + diedSinceArrestAttempt = false; } LocalPlayer::~LocalPlayer()