2012-09-13 13:02:26 +02:00
|
|
|
#include "actioneat.hpp"
|
|
|
|
|
2014-02-23 20:11:05 +01:00
|
|
|
#include <components/esm/loadskil.hpp>
|
|
|
|
|
2013-08-13 01:19:33 +02:00
|
|
|
#include "../mwworld/containerstore.hpp"
|
|
|
|
|
2015-09-10 18:48:34 +12:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
2012-09-13 13:02:26 +02:00
|
|
|
#include "class.hpp"
|
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
void ActionEat::executeImp (const Ptr& actor)
|
|
|
|
{
|
2013-08-13 01:19:33 +02:00
|
|
|
// remove used item (assume the item is present in inventory)
|
|
|
|
getTarget().getContainerStore()->remove(getTarget(), 1, actor);
|
2012-09-13 13:02:26 +02:00
|
|
|
|
2013-11-17 23:15:57 +01:00
|
|
|
// apply to actor
|
2015-12-18 16:58:08 +01:00
|
|
|
std::string id = getTarget().getCellRef().getRefId();
|
2014-02-23 20:11:05 +01:00
|
|
|
|
2015-09-10 18:48:34 +12:00
|
|
|
if (actor.getClass().apply (actor, id, actor) && actor == MWMechanics::getPlayer())
|
2014-05-22 20:37:22 +02:00
|
|
|
actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
|
2014-02-23 20:11:05 +01:00
|
|
|
}
|
2012-09-13 13:02:26 +02:00
|
|
|
|
|
|
|
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}
|
|
|
|
}
|