OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MWWorld::ContainerStore Class Reference

#include <containerstore.hpp>

Inheritance diagram for MWWorld::ContainerStore:
Collaboration diagram for MWWorld::ContainerStore:

Public Member Functions

 ContainerStore ()
 
virtual ~ContainerStore ()
 
virtual ContainerStoreclone ()
 
ContainerStoreIterator begin (int mask=Type_All)
 
ContainerStoreIterator end ()
 
virtual ContainerStoreIterator add (const Ptr &itemPtr, int count, const Ptr &actorPtr, bool setOwner=false)
 
ContainerStoreIterator add (const std::string &id, int count, const Ptr &actorPtr)
 Utility to construct a ManualRef and call add(ptr, count, actorPtr, true) More...
 
int remove (const std::string &itemId, int count, const Ptr &actor)
 
virtual int remove (const Ptr &item, int count, const Ptr &actor)
 
ContainerStoreIterator unstack (const Ptr &ptr, const Ptr &container, int count=1)
 
MWWorld::ContainerStoreIterator restack (const MWWorld::Ptr &item)
 
int count (const std::string &id)
 
ContainerStoreListenergetContListener () const
 
void setContListener (ContainerStoreListener *listener)
 
virtual bool stacks (const ConstPtr &ptr1, const ConstPtr &ptr2)
 
void fill (const ESM::InventoryList &items, const std::string &owner)
 Insert items into *this. More...
 
void restock (const ESM::InventoryList &items, const MWWorld::Ptr &ptr, const std::string &owner)
 
virtual void clear ()
 Empty container. More...
 
float getWeight () const
 Return total weight of the items contained in *this. More...
 
Ptr search (const std::string &id)
 
virtual void writeState (ESM::InventoryState &state) const
 
virtual void readState (const ESM::InventoryState &state)
 
template<typename T >
MWWorld::ContainerStoreIterator getState (CellRefList< T > &collection, const ESM::ObjectState &state)
 

Static Public Member Functions

static int getType (const ConstPtr &ptr)
 

Static Public Attributes

static const int Type_Potion = 0x0001
 
static const int Type_Apparatus = 0x0002
 
static const int Type_Armor = 0x0004
 
static const int Type_Book = 0x0008
 
static const int Type_Clothing = 0x0010
 
static const int Type_Ingredient = 0x0020
 
static const int Type_Light = 0x0040
 
static const int Type_Lockpick = 0x0080
 
static const int Type_Miscellaneous = 0x0100
 
static const int Type_Probe = 0x0200
 
static const int Type_Repair = 0x0400
 
static const int Type_Weapon = 0x0800
 
static const int Type_Last = Type_Weapon
 
static const int Type_All = 0xffff
 
static const std::string sGoldId = "gold_001"
 

Protected Member Functions

ContainerStoreIterator addNewStack (const ConstPtr &ptr, int count)
 Add the item to this container (do not try to stack it onto existing items) More...
 
virtual void flagAsModified ()
 

Private Member Functions

ContainerStoreIterator addImp (const Ptr &ptr, int count)
 
void addInitialItem (const std::string &id, const std::string &owner, int count, bool topLevel=true, const std::string &levItem="")
 
template<typename T >
ContainerStoreIterator getState (CellRefList< T > &collection, const ESM::ObjectState &state)
 
template<typename T >
void storeState (const LiveCellRef< T > &ref, ESM::ObjectState &state) const
 
template<typename T >
void storeStates (const CellRefList< T > &collection, ESM::InventoryState &inventory, int &index, bool equipable=false) const
 
virtual void storeEquipmentState (const MWWorld::LiveCellRefBase &ref, int index, ESM::InventoryState &inventory) const
 
virtual void readEquipmentState (const MWWorld::ContainerStoreIterator &iter, int index, const ESM::InventoryState &inventory)
 

Private Attributes

MWWorld::CellRefList< ESM::Potionpotions
 
MWWorld::CellRefList
< ESM::Apparatus
appas
 
MWWorld::CellRefList< ESM::Armorarmors
 
MWWorld::CellRefList< ESM::Bookbooks
 
MWWorld::CellRefList
< ESM::Clothing
clothes
 
MWWorld::CellRefList
< ESM::Ingredient
ingreds
 
MWWorld::CellRefList< ESM::Lightlights
 
MWWorld::CellRefList
< ESM::Lockpick
lockpicks
 
MWWorld::CellRefList
< ESM::Miscellaneous
miscItems
 
MWWorld::CellRefList< ESM::Probeprobes
 
MWWorld::CellRefList< ESM::Repairrepairs
 
MWWorld::CellRefList< ESM::Weaponweapons
 
std::map< std::pair
< std::string, std::string >
, int
mLevelledItemMap
 
ContainerStoreListenermListener
 
float mCachedWeight
 
bool mWeightUpToDate
 

Friends

class ContainerStoreIterator
 

Constructor & Destructor Documentation

MWWorld::ContainerStore::ContainerStore ( )

Here is the caller graph for this function:

MWWorld::ContainerStore::~ContainerStore ( )
virtual

Member Function Documentation

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add ( const Ptr itemPtr,
int  count,
const Ptr actorPtr,
bool  setOwner = false 
)
virtual

Add the item pointed to by ptr to this container. (Stacks automatically if needed)

Note
The item pointed to is not required to exist beyond this function call.
Attention
Do not add items to an existing stack by increasing the count instead of calling this function!
Parameters
setOwnerSet the owner of the added item to actorPtr? If false, the owner is reset to "".
Returns
if stacking happened, return iterator to the item that was stacked against, otherwise iterator to the newly inserted item.

Reimplemented in MWWorld::InventoryStore.

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add ( const std::string &  id,
int  count,
const Ptr actorPtr 
)

Utility to construct a ManualRef and call add(ptr, count, actorPtr, true)

Here is the call graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp ( const Ptr ptr,
int  count 
)
private

Here is the call graph for this function:

void MWWorld::ContainerStore::addInitialItem ( const std::string &  id,
const std::string &  owner,
int  count,
bool  topLevel = true,
const std::string &  levItem = "" 
)
private

Here is the call graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addNewStack ( const ConstPtr ptr,
int  count 
)
protected

Add the item to this container (do not try to stack it onto existing items)

Here is the call graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::begin ( int  mask = Type_All)

Here is the caller graph for this function:

void MWWorld::ContainerStore::clear ( )
virtual

Empty container.

Reimplemented in MWWorld::InventoryStore.

Here is the caller graph for this function:

virtual ContainerStore* MWWorld::ContainerStore::clone ( )
inlinevirtual

Reimplemented in MWWorld::InventoryStore.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWWorld::ContainerStore::count ( const std::string &  id)
Returns
How many items with refID id are in this container?

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end ( )
void MWWorld::ContainerStore::fill ( const ESM::InventoryList items,
const std::string &  owner 
)

Insert items into *this.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::flagAsModified ( )
protectedvirtual

Reimplemented in MWWorld::InventoryStore.

Here is the caller graph for this function:

MWWorld::ContainerStoreListener * MWWorld::ContainerStore::getContListener ( ) const

Here is the caller graph for this function:

template<typename T >
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::getState ( CellRefList< T > &  collection,
const ESM::ObjectState state 
)

Here is the call graph for this function:

template<typename T >
ContainerStoreIterator MWWorld::ContainerStore::getState ( CellRefList< T > &  collection,
const ESM::ObjectState state 
)
private
int MWWorld::ContainerStore::getType ( const ConstPtr ptr)
static

This function throws an exception, if ptr does not point to an object, that can be put into a container.

Here is the call graph for this function:

float MWWorld::ContainerStore::getWeight ( ) const

Return total weight of the items contained in *this.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::readEquipmentState ( const MWWorld::ContainerStoreIterator iter,
int  index,
const ESM::InventoryState inventory 
)
privatevirtual

Reimplemented in MWWorld::InventoryStore.

void MWWorld::ContainerStore::readState ( const ESM::InventoryState state)
virtual

Reimplemented in MWWorld::InventoryStore.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWWorld::ContainerStore::remove ( const std::string &  itemId,
int  count,
const Ptr actor 
)

Remove count item(s) designated by itemId from this container.

Returns
the number of items actually removed

Here is the call graph for this function:

Here is the caller graph for this function:

int MWWorld::ContainerStore::remove ( const Ptr item,
int  count,
const Ptr actor 
)
virtual

Remove count item(s) designated by item from this inventory.

Returns
the number of items actually removed

Reimplemented in MWWorld::InventoryStore.

Here is the call graph for this function:

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::restack ( const MWWorld::Ptr item)

Attempt to re-stack an item in this container. If a compatible stack is found, the item's count is added to that stack, then the original is deleted.

Returns
If the item was stacked, return the stack, otherwise return the old (untouched) item.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::restock ( const ESM::InventoryList items,
const MWWorld::Ptr ptr,
const std::string &  owner 
)

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::Ptr MWWorld::ContainerStore::search ( const std::string &  id)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::setContListener ( MWWorld::ContainerStoreListener listener)

Here is the caller graph for this function:

bool MWWorld::ContainerStore::stacks ( const ConstPtr ptr1,
const ConstPtr ptr2 
)
virtual
Returns
true if the two specified objects can stack with each other

Reimplemented in MWWorld::InventoryStore.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::storeEquipmentState ( const MWWorld::LiveCellRefBase ref,
int  index,
ESM::InventoryState inventory 
) const
privatevirtual

Reimplemented in MWWorld::InventoryStore.

template<typename T >
void MWWorld::ContainerStore::storeState ( const LiveCellRef< T > &  ref,
ESM::ObjectState state 
) const
private

Here is the call graph for this function:

template<typename T >
void MWWorld::ContainerStore::storeStates ( const CellRefList< T > &  collection,
ESM::InventoryState inventory,
int index,
bool  equipable = false 
) const
private
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::unstack ( const Ptr ptr,
const Ptr container,
int  count = 1 
)

Unstack an item in this container. The item's count will be set to count, then a new stack will be added with (origCount-count).

Returns
an iterator to the new stack, or end() if no new stack was created.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::ContainerStore::writeState ( ESM::InventoryState state) const
virtual

Reimplemented in MWWorld::InventoryStore.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class ContainerStoreIterator
friend

Member Data Documentation

MWWorld::CellRefList<ESM::Apparatus> MWWorld::ContainerStore::appas
private
MWWorld::CellRefList<ESM::Armor> MWWorld::ContainerStore::armors
private
MWWorld::CellRefList<ESM::Book> MWWorld::ContainerStore::books
private
MWWorld::CellRefList<ESM::Clothing> MWWorld::ContainerStore::clothes
private
MWWorld::CellRefList<ESM::Ingredient> MWWorld::ContainerStore::ingreds
private
MWWorld::CellRefList<ESM::Light> MWWorld::ContainerStore::lights
private
MWWorld::CellRefList<ESM::Lockpick> MWWorld::ContainerStore::lockpicks
private
float MWWorld::ContainerStore::mCachedWeight
mutableprivate
MWWorld::CellRefList<ESM::Miscellaneous> MWWorld::ContainerStore::miscItems
private
std::map<std::pair<std::string, std::string>, int> MWWorld::ContainerStore::mLevelledItemMap
private

Stores result of levelled item spawns. <(refId, spawningGroup), count> This is used to restock levelled items(s) if the old item was sold.

ContainerStoreListener* MWWorld::ContainerStore::mListener
private
bool MWWorld::ContainerStore::mWeightUpToDate
mutableprivate
MWWorld::CellRefList<ESM::Potion> MWWorld::ContainerStore::potions
private
MWWorld::CellRefList<ESM::Probe> MWWorld::ContainerStore::probes
private
MWWorld::CellRefList<ESM::Repair> MWWorld::ContainerStore::repairs
private
const std::string MWWorld::ContainerStore::sGoldId = "gold_001"
static
const int MWWorld::ContainerStore::Type_All = 0xffff
static
const int MWWorld::ContainerStore::Type_Apparatus = 0x0002
static
const int MWWorld::ContainerStore::Type_Armor = 0x0004
static
const int MWWorld::ContainerStore::Type_Book = 0x0008
static
const int MWWorld::ContainerStore::Type_Clothing = 0x0010
static
const int MWWorld::ContainerStore::Type_Ingredient = 0x0020
static
const int MWWorld::ContainerStore::Type_Last = Type_Weapon
static
const int MWWorld::ContainerStore::Type_Light = 0x0040
static
const int MWWorld::ContainerStore::Type_Lockpick = 0x0080
static
const int MWWorld::ContainerStore::Type_Miscellaneous = 0x0100
static
const int MWWorld::ContainerStore::Type_Potion = 0x0001
static
const int MWWorld::ContainerStore::Type_Probe = 0x0200
static
const int MWWorld::ContainerStore::Type_Repair = 0x0400
static
const int MWWorld::ContainerStore::Type_Weapon = 0x0800
static
MWWorld::CellRefList<ESM::Weapon> MWWorld::ContainerStore::weapons
private

The documentation for this class was generated from the following files: