From e5d54fb539e92ec2bf9754e4b06cceee9f90f1da Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 7 Sep 2015 22:13:20 +0200 Subject: [PATCH] Check for actor being the player in various actions --- apps/openmw/mwworld/actionalchemy.cpp | 3 +++ apps/openmw/mwworld/actionapply.cpp | 2 +- apps/openmw/mwworld/actioneat.cpp | 2 +- apps/openmw/mwworld/actionread.cpp | 3 +++ apps/openmw/mwworld/actionrepair.cpp | 3 +++ apps/openmw/mwworld/actionsoulgem.cpp | 3 +++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/actionalchemy.cpp b/apps/openmw/mwworld/actionalchemy.cpp index bbba1081c..f413f1aed 100644 --- a/apps/openmw/mwworld/actionalchemy.cpp +++ b/apps/openmw/mwworld/actionalchemy.cpp @@ -10,6 +10,9 @@ namespace MWWorld { void ActionAlchemy::executeImp (const Ptr& actor) { + if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr()) + return; + if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { //Ensure we're not in combat MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage3}"); return; diff --git a/apps/openmw/mwworld/actionapply.cpp b/apps/openmw/mwworld/actionapply.cpp index 00c9628ce..42757a41a 100644 --- a/apps/openmw/mwworld/actionapply.cpp +++ b/apps/openmw/mwworld/actionapply.cpp @@ -32,7 +32,7 @@ namespace MWWorld { MWBase::Environment::get().getWorld()->breakInvisibility(actor); - if (actor.getClass().apply (actor, mId, actor) && mUsageType!=-1) + if (actor.getClass().apply (actor, mId, actor) && mUsageType!=-1 && actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) actor.getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType); actor.getClass().getContainerStore(actor).remove(getTarget(), 1, actor); diff --git a/apps/openmw/mwworld/actioneat.cpp b/apps/openmw/mwworld/actioneat.cpp index d9ca4aaf5..5339a113e 100644 --- a/apps/openmw/mwworld/actioneat.cpp +++ b/apps/openmw/mwworld/actioneat.cpp @@ -19,7 +19,7 @@ namespace MWWorld // apply to actor std::string id = getTarget().getClass().getId (getTarget()); - if (actor.getClass().apply (actor, id, actor)) + if (actor.getClass().apply (actor, id, actor) && actor == MWBase::Environment::get().getWorld()->getPlayerPtr()) actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1); } diff --git a/apps/openmw/mwworld/actionread.cpp b/apps/openmw/mwworld/actionread.cpp index cd0471a0e..d77ca73fd 100644 --- a/apps/openmw/mwworld/actionread.cpp +++ b/apps/openmw/mwworld/actionread.cpp @@ -18,6 +18,9 @@ namespace MWWorld void ActionRead::executeImp (const MWWorld::Ptr& actor) { + if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr()) + return; + //Ensure we're not in combat if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat() // Reading in combat is still allowed if the scroll/book is not in the player inventory yet diff --git a/apps/openmw/mwworld/actionrepair.cpp b/apps/openmw/mwworld/actionrepair.cpp index 699440a01..993f32cde 100644 --- a/apps/openmw/mwworld/actionrepair.cpp +++ b/apps/openmw/mwworld/actionrepair.cpp @@ -14,6 +14,9 @@ namespace MWWorld void ActionRepair::executeImp (const Ptr& actor) { + if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr()) + return; + if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage2}"); return; diff --git a/apps/openmw/mwworld/actionsoulgem.cpp b/apps/openmw/mwworld/actionsoulgem.cpp index 7237fd334..f87c16482 100644 --- a/apps/openmw/mwworld/actionsoulgem.cpp +++ b/apps/openmw/mwworld/actionsoulgem.cpp @@ -16,6 +16,9 @@ namespace MWWorld void ActionSoulgem::executeImp(const Ptr &actor) { + if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr()) + return; + if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { //Ensure we're not in combat MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage5}"); return;