OpenMW
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends
MWWorld::ContainerStore Class Reference

#include <containerstore.hpp>

List of all members.

Public Member Functions

 ContainerStore ()
virtual ~ContainerStore ()
ContainerStoreIterator begin (int mask=Type_All)
ContainerStoreIterator end ()
virtual ContainerStoreIterator add (const Ptr &itemPtr, const Ptr &actorPtr)
ContainerStoreIterator add (const std::string &id, int count, const Ptr &actorPtr)
 Utility to construct a ManualRef and call add(ptr, actorPtr)
int remove (const std::string &itemId, int count, const Ptr &actor)
virtual int remove (const Ptr &item, int count, const Ptr &actor)
void unstack (const Ptr &ptr, const Ptr &container)
 Unstack an item in this container. The item's count will be set to 1, then a new stack will be added with (origCount-1).
virtual bool stacks (const Ptr &ptr1, const Ptr &ptr2)
void fill (const ESM::InventoryList &items, const std::string &owner, const MWWorld::ESMStore &store)
 Insert items into *this.
void clear ()
 Empty container.
float getWeight () const
 Return total weight of the items contained in *this.
Ptr search (const std::string &id)

Static Public Member Functions

static int getType (const Ptr &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

Protected Member Functions

ContainerStoreIterator addNewStack (const Ptr &ptr)
 Add the item to this container (do not try to stack it onto existing items)
virtual void flagAsModified ()

Private Member Functions

ContainerStoreIterator addImp (const Ptr &ptr)
void addInitialItem (const std::string &id, const std::string &owner, int count, unsigned char failChance=0, bool topLevel=true)

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
float mCachedWeight
bool mWeightUpToDate

Friends

class ContainerStoreIterator

Constructor & Destructor Documentation


Member Function Documentation

MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add ( const Ptr itemPtr,
const Ptr actorPtr 
) [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!
Returns:
if stacking happened, return iterator to the item that was stacked against, otherwise iterator to the newly inserted item.

Reimplemented in MWWorld::InventoryStore.

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

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

void MWWorld::ContainerStore::addInitialItem ( const std::string &  id,
const std::string &  owner,
int  count,
unsigned char  failChance = 0,
bool  topLevel = true 
) [private]
Todo:
implement item restocking (indicated by negative count)

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

Empty container.

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

Insert items into *this.

void MWWorld::ContainerStore::flagAsModified ( ) [protected, virtual]

Reimplemented in MWWorld::InventoryStore.

int MWWorld::ContainerStore::getType ( const Ptr ptr) [static]

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

Return total weight of the items contained in *this.

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
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.

MWWorld::Ptr MWWorld::ContainerStore::search ( const std::string &  id)
bool MWWorld::ContainerStore::stacks ( const Ptr ptr1,
const Ptr ptr2 
) [virtual]
Returns:
true if the two specified objects can stack with each other

Reimplemented in MWWorld::InventoryStore.

void MWWorld::ContainerStore::unstack ( const Ptr ptr,
const Ptr container 
)

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


Friends And Related Function Documentation

friend class ContainerStoreIterator [friend]

Member Data Documentation

float MWWorld::ContainerStore::mCachedWeight [mutable, private]
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_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]

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