Issue #370: replaced custom target handling in take action with base class implementation

This commit is contained in:
Marc Zinnschlag 2012-09-04 15:34:44 +02:00
parent ea1c3fe1e4
commit 8ed8dd649a
2 changed files with 3 additions and 7 deletions

View file

@ -10,7 +10,7 @@
namespace MWWorld namespace MWWorld
{ {
ActionTake::ActionTake (const MWWorld::Ptr& object) : mObject (object) {} ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (false, object) {}
void ActionTake::executeImp (const Ptr& actor) void ActionTake::executeImp (const Ptr& actor)
{ {
@ -20,10 +20,8 @@ namespace MWWorld
// insert into player's inventory // insert into player's inventory
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
MWWorld::Class::get (player).getContainerStore (player).add (mObject); MWWorld::Class::get (player).getContainerStore (player).add (getTarget());
// remove from world, if the item is currently in the world (it could also be in a container) MWBase::Environment::get().getWorld()->deleteObject (getTarget());
if (mObject.isInCell())
MWBase::Environment::get().getWorld()->deleteObject (mObject);
} }
} }

View file

@ -8,8 +8,6 @@ namespace MWWorld
{ {
class ActionTake : public Action class ActionTake : public Action
{ {
MWWorld::Ptr mObject;
virtual void executeImp (const Ptr& actor); virtual void executeImp (const Ptr& actor);
public: public: