1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/apps/openmw/mwworld/actiontake.cpp

28 lines
766 B
C++
Raw Normal View History

2010-08-07 18:25:17 +00:00
#include "actiontake.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
2010-08-07 18:25:17 +00:00
#include "class.hpp"
#include "containerstore.hpp"
2010-08-07 18:25:17 +00:00
namespace MWWorld
{
2012-09-04 18:56:28 +00:00
ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {}
2010-08-07 18:25:17 +00:00
2012-07-27 10:00:10 +00:00
void ActionTake::executeImp (const Ptr& actor)
2010-08-07 18:25:17 +00:00
{
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return;
2010-08-07 18:25:17 +00:00
// insert into player's inventory
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
2010-08-07 18:25:17 +00:00
MWWorld::Class::get (player).getContainerStore (player).add (getTarget());
2010-08-07 18:25:17 +00:00
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
2010-08-07 18:25:17 +00:00
}
}