mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-11 06:40:34 +00:00
Update reference of the interpreter context when an Activate results in a take action (Fixes #3727)
This commit is contained in:
parent
70c5f64caa
commit
45fb4f04b1
@ -480,6 +480,10 @@ namespace MWScript
|
|||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action = (ptr.getClass().activate(ptr, actor));
|
boost::shared_ptr<MWWorld::Action> action = (ptr.getClass().activate(ptr, actor));
|
||||||
action->execute (actor);
|
action->execute (actor);
|
||||||
|
if (action->getTarget() != MWWorld::Ptr() && action->getTarget() != ptr)
|
||||||
|
{
|
||||||
|
updatePtr(ptr, action->getTarget());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float InterpreterContext::getSecondsPassed() const
|
float InterpreterContext::getSecondsPassed() const
|
||||||
|
@ -12,6 +12,11 @@ const MWWorld::Ptr& MWWorld::Action::getTarget() const
|
|||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWWorld::Action::setTarget(const MWWorld::Ptr& target)
|
||||||
|
{
|
||||||
|
mTarget = target;
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Action::Action (bool keepSound, const Ptr& target) : mKeepSound (keepSound), mSoundOffset(0), mTarget (target)
|
MWWorld::Action::Action (bool keepSound, const Ptr& target) : mKeepSound (keepSound), mSoundOffset(0), mTarget (target)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -23,10 +23,12 @@ namespace MWWorld
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
const Ptr& getTarget() const;
|
void setTarget(const Ptr&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
const Ptr& getTarget() const;
|
||||||
|
|
||||||
Action (bool keepSound = false, const Ptr& target = Ptr());
|
Action (bool keepSound = false, const Ptr& target = Ptr());
|
||||||
///< \param keepSound Keep playing the sound even if the object the sound is played on is removed.
|
///< \param keepSound Keep playing the sound even if the object the sound is played on is removed.
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ namespace MWWorld
|
|||||||
{
|
{
|
||||||
MWBase::Environment::get().getMechanicsManager()->itemTaken(
|
MWBase::Environment::get().getMechanicsManager()->itemTaken(
|
||||||
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
|
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
|
||||||
actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
|
MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
|
||||||
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
|
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
|
||||||
|
setTarget(newitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user