Commit 79158b93 authored by Marc Zinnschlag's avatar Marc Zinnschlag

NPCs are using InventoryStore instead of ContainerStore from now on

parent 84c8cd37
......@@ -16,7 +16,7 @@
#include "../mwworld/actiontalk.hpp"
#include "../mwworld/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/customdata.hpp"
namespace
......@@ -29,7 +29,7 @@ namespace
MWMechanics::NpcStats mNpcStats;
MWMechanics::CreatureStats mCreatureStats;
MWMechanics::Movement mMovement;
MWWorld::ContainerStore mContainerStore;
MWWorld::InventoryStore mInventoryStore;
virtual MWWorld::CustomData *clone() const;
};
......@@ -161,7 +161,15 @@ namespace MWClass
{
ensureCustomData (ptr);
return dynamic_cast<CustomData&> (*ptr.getRefData().getCustomData()).mContainerStore;
return dynamic_cast<CustomData&> (*ptr.getRefData().getCustomData()).mInventoryStore;
}
MWWorld::InventoryStore& Npc::getInventoryStore (const MWWorld::Ptr& ptr)
const
{
ensureCustomData (ptr);
return dynamic_cast<CustomData&> (*ptr.getRefData().getCustomData()).mInventoryStore;
}
std::string Npc::getScript (const MWWorld::Ptr& ptr) const
......
......@@ -38,6 +38,9 @@ namespace MWClass
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
///< Return container store
virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;
///< Return inventory store
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
///< Generate action for activation
......
......@@ -77,6 +77,11 @@ namespace MWWorld
throw std::runtime_error ("class does not have a container store");
}
InventoryStore& Class::getInventoryStore (const Ptr& ptr) const
{
throw std::runtime_error ("class does not have an inventory store");
}
void Class::lock (const Ptr& ptr, int lockLevel) const
{
throw std::runtime_error ("class does not support locking");
......
......@@ -34,6 +34,7 @@ namespace MWWorld
class Ptr;
class Environment;
class ContainerStore;
class InventoryStore;
/// \brief Base class for referenceable esm records
class Class
......@@ -108,6 +109,10 @@ namespace MWWorld
///< Return container store or throw an exception, if class does not have a
/// container store (default implementation: throw an exceoption)
virtual InventoryStore& getInventoryStore (const Ptr& ptr) const;
///< Return inventory store or throw an exception, if class does not have a
/// inventory store (default implementation: throw an exceoption)
virtual void lock (const Ptr& ptr, int lockLevel) const;
///< Lock object (default implementation: throw an exception)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment