1 #ifndef GAME_MWWORLD_CONTAINERSTORE_H
2 #define GAME_MWWORLD_CONTAINERSTORE_H
27 struct InventoryState;
34 template<
class PtrType>
95 void addInitialItem (
const std::string&
id,
const std::string& owner,
int count,
bool topLevel=
true,
const std::string& levItem =
"");
107 bool equipable =
false)
const;
145 int remove(
const std::string& itemId,
int count,
const Ptr& actor);
150 virtual int remove(
const Ptr& item,
int count,
const Ptr& actor);
165 int count (
const std::string&
id);
191 virtual void clear();
215 template<
class PtrType>
217 :
public std::iterator<std::forward_iterator_tag, PtrType, std::ptrdiff_t, PtrType *, PtrType&>
219 template<
class From,
class To,
class Dummy>
225 template<
class Dummy>
231 template<
class T,
class U>
248 template<
class T,
class Dummy>
254 template<
class Dummy>
321 char CANNOT_CONVERT_CONST_ITERATOR_TO_ITERATOR[IsConvertible<T, PtrType, void>::value ? 1 : -1];
322 ((void)CANNOT_CONVERT_CONST_ITERATOR_TO_ITERATOR);
344 template<
class T,
class U>
346 template<
class T,
class U>
ContainerStoreIteratorBase(ContainerStoreType container)
End-iterator.
Definition: containerstore.cpp:1146
MWWorld::CellRefList< T >::List::iterator type
Definition: containerstore.hpp:234
Iterator< ESM::Repair >::type mRepair
Definition: containerstore.hpp:277
Used to create pointers to hold any type of LiveCellRef<> object.
Definition: livecellref.hpp:22
ContainerStoreListener * getContListener() const
Definition: containerstore.cpp:170
MWWorld::CellRefList< ESM::Apparatus > appas
Definition: containerstore.hpp:74
virtual void writeState(ESM::InventoryState &state) const
Definition: containerstore.cpp:780
int restockCount(const std::string &id)
Definition: containerstore.cpp:160
virtual ContainerStore * clone()
Definition: containerstore.hpp:120
int getType() const
Definition: containerstore.cpp:1134
MWWorld::CellRefList< ESM::Miscellaneous > miscItems
Definition: containerstore.hpp:81
static const int Type_Clothing
Definition: containerstore.hpp:56
static const int Type_Light
Definition: containerstore.hpp:58
MWWorld::CellRefList< ESM::Probe > probes
Definition: containerstore.hpp:82
ConstContainerStoreIterator cend() const
Definition: containerstore.cpp:126
bool operator==(const LiveCellRef< X > &ref, int pRefnum)
Definition: cellstore.cpp:207
Definition: containerstore.hpp:249
virtual void flagAsModified()
Definition: containerstore.cpp:604
Iterator< ESM::Lockpick >::type mLockpick
Definition: containerstore.hpp:274
ContainerStoreIteratorBase< Ptr > ContainerStoreIterator
Definition: containerstore.hpp:35
void restock(const ESM::InventoryList &items, const MWWorld::Ptr &ptr, const std::string &owner)
Definition: containerstore.cpp:511
Definition: containerstore.hpp:244
ConstContainerStoreIterator end() const
Definition: containerstore.cpp:136
ContainerStoreIterator addNewStack(const ConstPtr &ptr, int count)
Add the item to this container (do not try to stack it onto existing items)
Definition: containerstore.cpp:382
MWWorld::CellRefList< ESM::Armor > armors
Definition: containerstore.hpp:75
virtual bool stacks(const ConstPtr &ptr1, const ConstPtr &ptr2) const
Definition: containerstore.cpp:223
bool isEqual(const ContainerStoreIteratorBase< T > &other) const
Definition: containerstore.cpp:1038
static const bool value
Definition: containerstore.hpp:222
Iterator< ESM::Weapon >::type mWeapon
Definition: containerstore.hpp:278
bool mWeightUpToDate
Definition: containerstore.hpp:93
InventoryList, NPCO subrecord.
Definition: loadcont.hpp:26
virtual void readEquipmentState(const MWWorld::ContainerStoreIterator &iter, int index, const ESM::InventoryState &inventory)
Definition: containerstore.cpp:87
static const int Type_Armor
Definition: containerstore.hpp:54
static const int Type_Ingredient
Definition: containerstore.hpp:57
virtual ~ContainerStore()
Definition: containerstore.cpp:119
Definition: livecellref.hpp:77
static const int Type_Apparatus
Definition: containerstore.hpp:53
static const int Type_Weapon
Definition: containerstore.hpp:63
MWWorld::CellRefList< ESM::Book > books
Definition: containerstore.hpp:76
ContainerStoreIteratorBase & operator++()
Definition: containerstore.cpp:1103
ContainerStoreListener * mListener
Definition: containerstore.hpp:90
static const int Type_Last
Definition: containerstore.hpp:65
bool resetIterator()
Definition: containerstore.cpp:898
void copy(const ContainerStoreIteratorBase< T > &src)
Definition: containerstore.cpp:844
MWWorld::CellRefList< T >::List::const_iterator type
Definition: containerstore.hpp:240
static const int Type_Repair
Definition: containerstore.hpp:62
static const std::string sGoldId
Definition: containerstore.hpp:69
ContainerStoreIteratorBase & operator=(const ContainerStoreIteratorBase &rhs)
Definition: containerstore.cpp:1124
ConstContainerStoreIterator cbegin(int mask=Type_All) const
Definition: containerstore.cpp:121
void fill(const ESM::InventoryList &items, const std::string &owner)
Insert items into *this.
Definition: containerstore.cpp:449
Definition: containerstore.hpp:232
MWWorld::CellRefList< ESM::Repair > repairs
Definition: containerstore.hpp:83
virtual void itemAdded(const ConstPtr &item, int count)
Definition: containerstore.hpp:44
ConstContainerStoreIterator begin(int mask=Type_All) const
Definition: containerstore.cpp:131
Iterator< ESM::Clothing >::type mClothing
Definition: containerstore.hpp:271
const ContainerStore * getContainerStore() const
Definition: containerstore.cpp:1140
float getWeight() const
Return total weight of the items contained in *this.
Definition: containerstore.cpp:609
Ptr search(const std::string &id)
Definition: containerstore.cpp:703
MWWorld::CellRefList< ESM::Ingredient > ingreds
Definition: containerstore.hpp:78
static const int Type_Book
Definition: containerstore.hpp:55
bool incIterator()
Definition: containerstore.cpp:967
ContainerStoreTrait< PtrType, void >::type ContainerStoreType
Definition: containerstore.hpp:260
MWWorld::CellRefList< ESM::Weapon > weapons
Definition: containerstore.hpp:84
Definition: containerstore.hpp:41
int mType
Definition: containerstore.hpp:262
ContainerStoreIterator addImp(const Ptr &ptr, int count)
Definition: containerstore.cpp:339
<
Definition: objectstate.hpp:19
Definition: containerstore.hpp:35
MWWorld::CellRefList< ESM::Clothing > clothes
Definition: containerstore.hpp:77
Iterator< ESM::Probe >::type mProbe
Definition: containerstore.hpp:276
Iterator< ESM::Apparatus >::type mApparatus
Definition: containerstore.hpp:268
virtual void clear()
Empty container.
Definition: containerstore.cpp:596
void incType()
Definition: containerstore.cpp:871
Iterator< ESM::Miscellaneous >::type mMiscellaneous
Definition: containerstore.hpp:275
MWWorld::ContainerStoreIterator restack(const MWWorld::Ptr &item)
Definition: containerstore.cpp:195
Pointer to a const LiveCellRef.
Definition: ptr.hpp:90
virtual ContainerStoreIterator add(const Ptr &itemPtr, int count, const Ptr &actorPtr, bool setOwner=false)
Definition: containerstore.cpp:263
ContainerStoreIteratorBase(const ContainerStoreIteratorBase< T > &other)
Definition: containerstore.hpp:319
MWWorld::CellRefList< ESM::Lockpick > lockpicks
Definition: containerstore.hpp:80
static const int Type_Probe
Definition: containerstore.hpp:61
State for inventories and containers.
Definition: inventorystate.hpp:16
MWWorld::CellRefList< ESM::Potion > potions
Definition: containerstore.hpp:73
void setContListener(ContainerStoreListener *listener)
Definition: containerstore.cpp:176
Definition: containerstore.hpp:48
ContainerStore * type
Definition: containerstore.hpp:251
int mMask
Definition: containerstore.hpp:263
ContainerStoreIterator getState(CellRefList< T > &collection, const ESM::ObjectState &state)
static const int Type_Potion
Definition: containerstore.hpp:52
virtual void storeEquipmentState(const MWWorld::LiveCellRefBase &ref, int index, ESM::InventoryState &inventory) const
Definition: containerstore.cpp:83
void nextType()
Definition: containerstore.cpp:885
static const int Type_All
Definition: containerstore.hpp:67
void storeState(const LiveCellRef< T > &ref, ESM::ObjectState &state) const
Definition: containerstore.cpp:92
ContainerStoreIteratorBase< ConstPtr > ConstContainerStoreIterator
Definition: containerstore.hpp:38
Ptr findReplacement(const std::string &id)
Returns replacement for object with given id. Prefer used items (with low durability left)...
Definition: containerstore.cpp:679
Definition: containerstore.hpp:220
ContainerStore()
Definition: containerstore.cpp:117
static int getType(const ConstPtr &ptr)
Definition: containerstore.cpp:634
PtrType operator*() const
Definition: containerstore.cpp:1074
PtrType mPtr
Definition: containerstore.hpp:265
Iterator< ESM::Potion >::type mPotion
Definition: containerstore.hpp:267
std::map< std::pair< std::string, std::string >, int > mLevelledItemMap
Definition: containerstore.hpp:86
void addInitialItem(const std::string &id, const std::string &owner, int count, bool topLevel=true, const std::string &levItem="")
Definition: containerstore.cpp:461
ContainerStoreType mContainer
Definition: containerstore.hpp:264
PtrType * operator->() const
Definition: containerstore.cpp:1067
Iterator< ESM::Book >::type mBook
Definition: containerstore.hpp:270
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
Iterator< ESM::Ingredient >::type mIngredient
Definition: containerstore.hpp:272
bool operator!=(const CellStore &left, const CellStore &right)
Definition: cellstore.cpp:930
Iterator< ESM::Armor >::type mArmor
Definition: containerstore.hpp:269
MWWorld::CellRefList< ESM::Light > lights
Definition: containerstore.hpp:79
Iterator< ESM::Light >::type mLight
Definition: containerstore.hpp:273
ContainerStoreIterator unstack(const Ptr &ptr, const Ptr &container, int count=1)
Definition: containerstore.cpp:181
static const int Type_Miscellaneous
Definition: containerstore.hpp:60
virtual void itemRemoved(const ConstPtr &item, int count)
Definition: containerstore.hpp:45
int count(const std::string &id)
Definition: containerstore.cpp:151
void storeStates(const CellRefList< T > &collection, ESM::InventoryState &inventory, int &index, bool equipable=false) const
Definition: containerstore.cpp:98
float mCachedWeight
Definition: containerstore.hpp:92
static const int Type_Lockpick
Definition: containerstore.hpp:59
const ContainerStore * type
Definition: containerstore.hpp:257
virtual void readState(const ESM::InventoryState &state)
Definition: containerstore.cpp:801