forked from teamnwah/openmw-tes3coop
implemented take action
This commit is contained in:
parent
aa637cb9d4
commit
a7fe28ecbe
32 changed files with 249 additions and 13 deletions
|
@ -83,6 +83,7 @@ set(GAMEWORLD
|
||||||
mwworld/globals.cpp
|
mwworld/globals.cpp
|
||||||
mwworld/class.cpp
|
mwworld/class.cpp
|
||||||
mwworld/actionteleport.cpp
|
mwworld/actionteleport.cpp
|
||||||
|
mwworld/actiontake.cpp
|
||||||
mwworld/containerutil.cpp
|
mwworld/containerutil.cpp
|
||||||
)
|
)
|
||||||
set(GAMEWORLD_HEADER
|
set(GAMEWORLD_HEADER
|
||||||
|
@ -95,6 +96,7 @@ set(GAMEWORLD_HEADER
|
||||||
mwworld/action.hpp
|
mwworld/action.hpp
|
||||||
mwworld/nullaction.hpp
|
mwworld/nullaction.hpp
|
||||||
mwworld/actionteleport.hpp
|
mwworld/actionteleport.hpp
|
||||||
|
mwworld/actiontake.hpp
|
||||||
mwworld/containerstore.hpp
|
mwworld/containerstore.hpp
|
||||||
mwworld/manualref.hpp
|
mwworld/manualref.hpp
|
||||||
mwworld/containerutil.hpp
|
mwworld/containerutil.hpp
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Apparatus::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Apparatus::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
bool Armor::hasItemHealth (const MWWorld::Ptr& ptr) const
|
bool Armor::hasItemHealth (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return Item health data available?
|
///< \return Item health data available?
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,15 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
// TODO implement reading
|
||||||
|
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Book::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Book::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Clothing::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Clothing::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Ingredient::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Ingredient::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -22,6 +24,19 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
|
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||||
|
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Light::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Light::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Lockpick::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Lockpick::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Misc::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Misc::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Misc::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Potion::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Potion::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Probe::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Probe::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
void Repair::insertIntoContainer (const MWWorld::Ptr& ptr,
|
void Repair::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||||
///< Insert into a containe
|
///< Insert into a containe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
|
@ -19,6 +20,13 @@ namespace MWClass
|
||||||
return ref->base->name;
|
return ref->base->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
return boost::shared_ptr<MWWorld::Action> (
|
||||||
|
new MWWorld::ActionTake (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
bool Weapon::hasItemHealth (const MWWorld::Ptr& ptr) const
|
bool Weapon::hasItemHealth (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -13,6 +13,10 @@ namespace MWClass
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||||
|
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||||
|
///< Generate action for activation
|
||||||
|
|
||||||
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return Item health data available?
|
///< \return Item health data available?
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,10 @@ namespace MWRender
|
||||||
|
|
||||||
/// Make the reference with the given handle invisible.
|
/// Make the reference with the given handle invisible.
|
||||||
virtual void disable (const std::string& handle) = 0;
|
virtual void disable (const std::string& handle) = 0;
|
||||||
|
|
||||||
|
/// Remove the reference with the given handle permanently from the scene.
|
||||||
|
virtual void deleteObject (const std::string& handle) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,16 @@ void InteriorCellRender::disable (const std::string& handle)
|
||||||
scene.getMgr()->getSceneNode (handle)->setVisible (false);
|
scene.getMgr()->getSceneNode (handle)->setVisible (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InteriorCellRender::deleteObject (const std::string& handle)
|
||||||
|
{
|
||||||
|
if (!handle.empty())
|
||||||
|
{
|
||||||
|
Ogre::SceneNode *node = scene.getMgr()->getSceneNode (handle);
|
||||||
|
node->removeAndDestroyAllChildren();
|
||||||
|
scene.getMgr()->destroySceneNode (node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Magic function from the internets. Might need this later.
|
// Magic function from the internets. Might need this later.
|
||||||
/*
|
/*
|
||||||
void Scene::DestroyAllAttachedMovableObjects( SceneNode* i_pSceneNode )
|
void Scene::DestroyAllAttachedMovableObjects( SceneNode* i_pSceneNode )
|
||||||
|
|
|
@ -102,8 +102,10 @@ namespace MWRender
|
||||||
|
|
||||||
/// Make the reference with the given handle invisible.
|
/// Make the reference with the given handle invisible.
|
||||||
virtual void disable (const std::string& handle);
|
virtual void disable (const std::string& handle);
|
||||||
|
|
||||||
|
/// Remove the reference with the given handle permanently from the scene.
|
||||||
|
virtual void deleteObject (const std::string& handle);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
23
apps/openmw/mwworld/actiontake.cpp
Normal file
23
apps/openmw/mwworld/actiontake.cpp
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
21
apps/openmw/mwworld/actiontake.hpp
Normal file
21
apps/openmw/mwworld/actiontake.hpp
Normal file
|
@ -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
|
|
@ -611,4 +611,25 @@ namespace MWWorld
|
||||||
|
|
||||||
return result.first;
|
return result.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::deleteObject (Ptr ptr)
|
||||||
|
{
|
||||||
|
if (ptr.getRefData().getCount()>0)
|
||||||
|
{
|
||||||
|
ptr.getRefData().setCount (0);
|
||||||
|
|
||||||
|
if (MWRender::CellRender *render = searchRender (ptr.getCell()))
|
||||||
|
{
|
||||||
|
render->deleteObject (ptr.getRefData().getHandle());
|
||||||
|
ptr.getRefData().setHandle ("");
|
||||||
|
|
||||||
|
if (mActiveCells.find (ptr.getCell())!=mActiveCells.end() &&
|
||||||
|
(ptr.getType()==typeid (ESMS::LiveCellRef<ESM::NPC, RefData>) ||
|
||||||
|
ptr.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
||||||
|
{
|
||||||
|
mEnvironment.mMechanicsManager->removeActor (ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,8 @@ namespace MWWorld
|
||||||
|
|
||||||
std::string getFacedHandle();
|
std::string getFacedHandle();
|
||||||
///< Return handle of the object the player is looking at
|
///< Return handle of the object the player is looking at
|
||||||
|
|
||||||
|
void deleteObject (Ptr ptr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue