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