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