forked from mirror/openmw-tes3mp
implemented take action
parent
aa637cb9d4
commit
a7fe28ecbe
@ -0,0 +1,23 @@
|
||||
|
||||
#include "actiontake.hpp"
|
||||
|
||||
#include "class.hpp"
|
||||
#include "environment.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
ActionTake::ActionTake (const MWWorld::Ptr& object) : mObject (object) {}
|
||||
|
||||
void ActionTake::execute (Environment& environment)
|
||||
{
|
||||
// insert into player's inventory
|
||||
MWWorld::Ptr player = environment.mWorld->getPtr ("player", true);
|
||||
|
||||
MWWorld::Class::get (mObject).insertIntoContainer (mObject,
|
||||
MWWorld::Class::get (player).getContainerStore (player));
|
||||
|
||||
// remove from world
|
||||
environment.mWorld->deleteObject (mObject);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
#ifndef GAME_MWWORLD_ACTIONTAKE_H
|
||||
#define GAME_MWWORLD_ACTIONTAKE_H
|
||||
|
||||
#include "action.hpp"
|
||||
#include "ptr.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class ActionTake : public Action
|
||||
{
|
||||
MWWorld::Ptr mObject;
|
||||
|
||||
public:
|
||||
|
||||
ActionTake (const MWWorld::Ptr& object);
|
||||
|
||||
virtual void execute (Environment& environment);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue