1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00
OpenMW/apps/openmw/mwworld/actioneat.cpp

27 lines
744 B
C++
Raw Normal View History

#include "actioneat.hpp"
2014-02-23 20:11:05 +01:00
#include <components/esm/loadskil.hpp>
#include "../mwworld/containerstore.hpp"
2015-09-10 18:48:34 +12:00
#include "../mwmechanics/actorutil.hpp"
#include "class.hpp"
namespace MWWorld
{
void ActionEat::executeImp (const Ptr& actor)
{
// remove used item (assume the item is present in inventory)
getTarget().getContainerStore()->remove(getTarget(), 1, actor);
// 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())
actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
2014-02-23 20:11:05 +01:00
}
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}
}