forked from teamnwah/openmw-tes3coop
turned ContainerStore from a template into a simple struct
This commit is contained in:
parent
8de6761a79
commit
f2972b1ca0
35 changed files with 54 additions and 58 deletions
|
@ -60,7 +60,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Apparatus::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.appas);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Armor::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.armors);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace MWClass
|
|||
///< Return item max health or throw an exception, if class does not have item health
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Book::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.books);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Clothing::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.clothes);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace
|
|||
{
|
||||
struct CustomData : public MWWorld::CustomData
|
||||
{
|
||||
MWWorld::ContainerStore<MWWorld::RefData> mContainerStore;
|
||||
MWWorld::ContainerStore mContainerStore;
|
||||
|
||||
virtual MWWorld::CustomData *clone() const;
|
||||
};
|
||||
|
@ -79,7 +79,7 @@ namespace MWClass
|
|||
return ref->base->name;
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& Container::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
const
|
||||
{
|
||||
ensureCustomData (ptr);
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace MWClass
|
|||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
||||
virtual MWWorld::ContainerStore<MWWorld::RefData>& getContainerStore (
|
||||
const MWWorld::Ptr& ptr) const;
|
||||
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
|
||||
///< Return container store
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace
|
|||
struct CustomData : public MWWorld::CustomData
|
||||
{
|
||||
MWMechanics::CreatureStats mCreatureStats;
|
||||
MWWorld::ContainerStore<MWWorld::RefData> mContainerStore;
|
||||
MWWorld::ContainerStore mContainerStore;
|
||||
|
||||
virtual MWWorld::CustomData *clone() const;
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ namespace MWClass
|
|||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& Creature::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
const
|
||||
{
|
||||
ensureCustomData (ptr);
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace MWClass
|
|||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual MWWorld::ContainerStore<MWWorld::RefData>& getContainerStore (
|
||||
virtual MWWorld::ContainerStore& getContainerStore (
|
||||
const MWWorld::Ptr& ptr) const;
|
||||
///< Return container store
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Ingredient::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.ingreds);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Light::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.lights);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Lockpick::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.lockpicks);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Miscellaneous::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.miscItems);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace
|
|||
MWMechanics::NpcStats mNpcStats;
|
||||
MWMechanics::CreatureStats mCreatureStats;
|
||||
MWMechanics::Movement mMovement;
|
||||
MWWorld::ContainerStore<MWWorld::RefData> mContainerStore;
|
||||
MWWorld::ContainerStore mContainerStore;
|
||||
|
||||
virtual MWWorld::CustomData *clone() const;
|
||||
};
|
||||
|
@ -156,7 +156,7 @@ namespace MWClass
|
|||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& Npc::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
MWWorld::ContainerStore& Npc::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
const
|
||||
{
|
||||
ensureCustomData (ptr);
|
||||
|
|
|
@ -35,8 +35,7 @@ namespace MWClass
|
|||
virtual MWMechanics::NpcStats& getNpcStats (const MWWorld::Ptr& ptr) const;
|
||||
///< Return NPC stats
|
||||
|
||||
virtual MWWorld::ContainerStore<MWWorld::RefData>& getContainerStore (
|
||||
const MWWorld::Ptr& ptr) const;
|
||||
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
|
||||
///< Return container store
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Potion::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.potions);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace MWClass
|
|||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
|
@ -59,7 +59,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Probe::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.probes);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Repair::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.repairs);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MWClass
|
|||
///< Generate action for activation
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Weapon::insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const
|
||||
MWWorld::ContainerStore& containerStore) const
|
||||
{
|
||||
insertIntoContainerStore (ptr, containerStore.weapons);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace MWClass
|
|||
///< Return item max health or throw an exception, if class does not have item health
|
||||
|
||||
virtual void insertIntoContainer (const MWWorld::Ptr& ptr,
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& containerStore) const;
|
||||
MWWorld::ContainerStore& containerStore) const;
|
||||
///< Insert into a containe
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -71,12 +71,12 @@ namespace MWWorld
|
|||
return boost::shared_ptr<Action> (new NullAction);
|
||||
}
|
||||
|
||||
ContainerStore<RefData>& Class::getContainerStore (const Ptr& ptr) const
|
||||
ContainerStore& Class::getContainerStore (const Ptr& ptr) const
|
||||
{
|
||||
throw std::runtime_error ("class does not have a container store");
|
||||
}
|
||||
|
||||
void Class::insertIntoContainer (const Ptr& ptr, ContainerStore<RefData>& containerStore) const
|
||||
void Class::insertIntoContainer (const Ptr& ptr, ContainerStore& containerStore) const
|
||||
{
|
||||
throw std::runtime_error ("class does not support inserting into a container");
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ namespace MWWorld
|
|||
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||
/// (default implementation: throw an exception)
|
||||
|
||||
|
||||
|
||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const;
|
||||
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||
|
@ -105,11 +103,11 @@ namespace MWWorld
|
|||
///< Generate action for using via inventory menu (default implementation: return a
|
||||
/// null action).
|
||||
|
||||
virtual ContainerStore<RefData>& getContainerStore (const Ptr& ptr) const;
|
||||
virtual ContainerStore& getContainerStore (const Ptr& ptr) const;
|
||||
///< Return container store or throw an exception, if class does not have a
|
||||
/// container store (default implementation: throw an exceoption)
|
||||
|
||||
virtual void insertIntoContainer (const Ptr& ptr, ContainerStore<RefData>& containerStore)
|
||||
virtual void insertIntoContainer (const Ptr& ptr, ContainerStore& containerStore)
|
||||
const;
|
||||
///< Insert into a container or throw an exception, if class does not support inserting into
|
||||
/// a container.
|
||||
|
|
|
@ -3,23 +3,24 @@
|
|||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "refdata.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
template<typename D>
|
||||
struct ContainerStore
|
||||
{
|
||||
ESMS::CellRefList<ESM::Potion, D> potions;
|
||||
ESMS::CellRefList<ESM::Apparatus, D> appas;
|
||||
ESMS::CellRefList<ESM::Armor, D> armors;
|
||||
ESMS::CellRefList<ESM::Book, D> books;
|
||||
ESMS::CellRefList<ESM::Clothing, D> clothes;
|
||||
ESMS::CellRefList<ESM::Ingredient, D> ingreds;
|
||||
ESMS::CellRefList<ESM::Light, D> lights;
|
||||
ESMS::CellRefList<ESM::Tool, D> lockpicks;
|
||||
ESMS::CellRefList<ESM::Miscellaneous, D> miscItems;
|
||||
ESMS::CellRefList<ESM::Probe, D> probes;
|
||||
ESMS::CellRefList<ESM::Repair, D> repairs;
|
||||
ESMS::CellRefList<ESM::Weapon, D> weapons;
|
||||
ESMS::CellRefList<ESM::Potion, RefData> potions;
|
||||
ESMS::CellRefList<ESM::Apparatus, RefData> appas;
|
||||
ESMS::CellRefList<ESM::Armor, RefData> armors;
|
||||
ESMS::CellRefList<ESM::Book, RefData> books;
|
||||
ESMS::CellRefList<ESM::Clothing, RefData> clothes;
|
||||
ESMS::CellRefList<ESM::Ingredient, RefData> ingreds;
|
||||
ESMS::CellRefList<ESM::Light, RefData> lights;
|
||||
ESMS::CellRefList<ESM::Tool, RefData> lockpicks;
|
||||
ESMS::CellRefList<ESM::Miscellaneous, RefData> miscItems;
|
||||
ESMS::CellRefList<ESM::Probe, RefData> probes;
|
||||
ESMS::CellRefList<ESM::Repair, RefData> repairs;
|
||||
ESMS::CellRefList<ESM::Weapon, RefData> weapons;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace
|
|||
namespace MWWorld
|
||||
{
|
||||
void listItemsInContainer (const std::string& id,
|
||||
ContainerStore<MWWorld::RefData>& containerStore,
|
||||
ContainerStore& containerStore,
|
||||
const ESMS::ESMStore& store, std::vector<Ptr>& list)
|
||||
{
|
||||
listItemsInContainerImp (id, containerStore.potions, store.potions, list);
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
|
||||
#include "containerstore.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "refdata.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
void listItemsInContainer (const std::string& id, ContainerStore<MWWorld::RefData>& containerStore,
|
||||
void listItemsInContainer (const std::string& id, ContainerStore& containerStore,
|
||||
const ESMS::ESMStore& store, std::vector<Ptr>& list);
|
||||
///< append all references with the given id to list.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue