1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/apps/openmw/mwworld/actionapply.cpp

42 lines
1.2 KiB
C++
Raw Normal View History

2012-07-13 07:41:38 +00:00
#include "actionapply.hpp"
#include "class.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/containerstore.hpp"
2012-07-13 07:41:38 +00:00
namespace MWWorld
{
ActionApply::ActionApply (const Ptr& object, const std::string& id)
: Action (false, object), mId (id)
2012-07-13 07:41:38 +00:00
{}
2012-07-27 10:00:10 +00:00
void ActionApply::executeImp (const Ptr& actor)
2012-07-13 07:41:38 +00:00
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
actor.getClass().apply (actor, mId, actor);
actor.getClass().getContainerStore(actor).remove(getTarget(), 1, actor);
2012-07-13 07:41:38 +00:00
}
ActionApplyWithSkill::ActionApplyWithSkill (const Ptr& object, const std::string& id,
2012-07-27 10:00:10 +00:00
int skillIndex, int usageType)
: Action (false, object), mId (id), mSkillIndex (skillIndex), mUsageType (usageType)
2012-07-13 07:41:38 +00:00
{}
2012-07-27 10:00:10 +00:00
void ActionApplyWithSkill::executeImp (const Ptr& actor)
2012-07-13 07:41:38 +00:00
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
if (actor.getClass().apply (actor, mId, actor) && mUsageType!=-1)
actor.getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType);
actor.getClass().getContainerStore(actor).remove(getTarget(), 1, actor);
2012-07-13 07:41:38 +00:00
}
}