22 ItemStack(
const std::string &name_, u16 count_,
28 void serialize(std::ostream &os,
bool serialize_meta =
true)
const;
111 if (item_cap == NULL)
115 assert(item_cap != NULL);
123 if (meta_override.has_value())
124 return meta_override;
134 if(amount > 65535 -
wear)
136 else if(amount < -
wear)
174 this->count == s.
count &&
175 this->wear == s.
wear &&
181 return !(*
this == s);
201 void setName(
const std::string &name);
202 void serialize(std::ostream &os,
bool incremental)
const;
210 return !(*
this == other);
276 u32 count = 0,
bool swap_if_needed =
true,
bool *did_swap = NULL);
326 return !(*
this == other);
330 void serialize(std::ostream &os,
bool incremental =
false)
const;
353 for (
const auto &list :
m_lists)
354 if (list->checkModified())
365 for (
const auto &list :
m_lists)
366 list->setModified(dirty);
virtual const ItemDefinition & get(const std::string &name) const =0
virtual bool isKnown(const std::string &name) const =0
Definition inventory.h:194
bool operator==(const InventoryList &other) const
Definition inventory.cpp:558
u32 getSize() const
Definition inventory.h:214
bool containsItem(const ItemStack &item, bool match_meta) const
Definition inventory.cpp:679
const ItemStack & getItem(u32 i) const
Definition inventory.h:220
const std::vector< ItemStack > & getItems() const
Definition inventory.h:231
ItemStack addItem(const ItemStack &newitem)
Definition inventory.cpp:603
std::vector< ItemStack > m_items
Definition inventory.h:304
void checkResizeLock()
Definition inventory.cpp:796
bool operator!=(const InventoryList &other) const
Definition inventory.h:208
IItemDefManager * m_itemdef
Definition inventory.h:308
InventoryList(const InventoryList &other)
Definition inventory.h:205
int m_resize_locks
Definition inventory.h:310
bool m_dirty
Definition inventory.h:309
void setName(const std::string &name)
Definition inventory.cpp:460
void setWidth(u32 newWidth)
Definition inventory.cpp:454
bool checkModified() const
Definition inventory.h:282
ItemStack removeItem(const ItemStack &item)
Definition inventory.cpp:698
std::string m_name
Definition inventory.h:305
u32 m_size
Definition inventory.h:306
void deSerialize(std::istream &is)
Definition inventory.cpp:488
u32 getUsedSlots() const
Definition inventory.cpp:573
InventoryList(const std::string &name, u32 size, IItemDefManager *itemdef)
Definition inventory.cpp:422
u32 getWidth() const
Definition inventory.h:215
ItemStack & getItem(u32 i)
Definition inventory.h:225
ItemStack moveItem(u32 i, InventoryList *dest, u32 dest_i, u32 count=0, bool swap_if_needed=true, bool *did_swap=NULL)
Definition inventory.cpp:752
ItemStack changeItem(u32 i, const ItemStack &newitem)
Definition inventory.cpp:583
ResizeLocked resizeLock()
Definition inventory.h:297
void setModified(bool dirty=true)
Definition inventory.h:283
void setSize(u32 newsize)
Definition inventory.cpp:441
InventoryList & operator=(const InventoryList &other)
Definition inventory.cpp:544
void clearItems()
Definition inventory.cpp:430
void serialize(std::ostream &os, bool incremental) const
Definition inventory.cpp:466
void deleteItem(u32 i)
Definition inventory.cpp:596
const std::string & getName() const
Definition inventory.h:213
bool roomForItem(const ItemStack &item) const
Definition inventory.cpp:666
u32 m_width
Definition inventory.h:307
ItemStack takeItem(u32 i, u32 takecount)
Definition inventory.cpp:718
std::unique_ptr< InventoryList, ResizeUnlocker > ResizeLocked
Definition inventory.h:293
bool itemFits(const u32 i, const ItemStack &newitem, ItemStack *restitem=NULL) const
Definition inventory.cpp:653
void moveItemSomewhere(u32 i, InventoryList *dest, u32 count)
Definition inventory.cpp:729
Definition inventory.h:314
ItemStack addItem(const std::string &listname, const ItemStack &newitem)
Definition inventory.h:340
void clear()
Definition inventory.cpp:814
Inventory(IItemDefManager *itemdef)
Definition inventory.cpp:829
InventoryList * getList(const std::string &name)
Definition inventory.cpp:982
bool deleteList(const std::string &name)
Definition inventory.cpp:990
InventoryList * addList(const std::string &name, u32 size)
Definition inventory.cpp:956
bool operator==(const Inventory &other) const
Definition inventory.cpp:855
bool checkModified() const
Definition inventory.h:348
IItemDefManager * m_itemdef
Definition inventory.h:374
~Inventory()
Definition inventory.cpp:809
const std::vector< InventoryList * > & getLists() const
Definition inventory.h:337
void setModified(bool dirty=true)
Definition inventory.h:360
s32 getListIndex(const std::string &name) const
Definition inventory.cpp:1012
void serialize(std::ostream &os, bool incremental=false) const
Definition inventory.cpp:868
bool m_dirty
Definition inventory.h:375
void deSerialize(std::istream &is)
Definition inventory.cpp:883
Inventory & operator=(const Inventory &other)
Definition inventory.cpp:840
std::vector< InventoryList * > m_lists
Definition inventory.h:373
bool operator!=(const Inventory &other) const
Definition inventory.h:324
core::vector3df v3f
Definition irr_v3d.h:11
@ ITEM_TOOL
Definition itemdef.h:38
Definition inventory.h:287
void operator()(InventoryList *invlist)
Definition inventory.h:288
u16 stack_max
Definition itemdef.h:89
ToolCapabilities * tool_capabilities
Definition itemdef.h:95
std::optional< WearBarParams > wear_bar_params
Definition itemdef.h:97
Definition inventory.h:19
void add(u16 n)
Definition inventory.h:62
std::string getWieldImage(const IItemDefManager *itemdef) const
Definition inventory.cpp:277
u16 freeSpace(const IItemDefManager *itemdef) const
Definition inventory.h:82
std::string getInventoryOverlay(const IItemDefManager *itemdef) const
Definition inventory.cpp:268
u16 count
Definition inventory.h:188
ItemStack peekItem(u32 peekcount) const
Definition inventory.cpp:407
void clear()
Definition inventory.h:54
ItemStack takeItem(u32 takecount)
Definition inventory.cpp:387
bool operator!=(const ItemStack &s) const
Definition inventory.h:179
void serialize(std::ostream &os, bool serialize_meta=true) const
Definition inventory.cpp:43
std::string getShortDescription(const IItemDefManager *itemdef) const
Definition inventory.cpp:245
std::string getWieldOverlay(const IItemDefManager *itemdef) const
Definition inventory.cpp:286
bool addWear(s32 amount, const IItemDefManager *itemdef)
Definition inventory.h:130
std::string getItemString(bool include_meta=true) const
Definition inventory.cpp:230
bool isKnown(const IItemDefManager *itemdef) const
Definition inventory.h:91
bool itemFits(ItemStack newitem, ItemStack *restitem, IItemDefManager *itemdef) const
Definition inventory.cpp:341
const ItemDefinition & getDefinition(const IItemDefManager *itemdef) const
Definition inventory.h:98
std::string getDescription(const IItemDefManager *itemdef) const
Definition inventory.cpp:237
ItemStackMetadata metadata
Definition inventory.h:190
std::string getInventoryImage(const IItemDefManager *itemdef) const
Definition inventory.cpp:259
bool empty() const
Definition inventory.h:49
std::string name
Definition inventory.h:187
bool stacksWith(const ItemStack &other) const
Definition inventory.cpp:380
u16 getStackMax(const IItemDefManager *itemdef) const
Definition inventory.h:76
u16 wear
Definition inventory.h:189
void deSerialize(std::istream &is, IItemDefManager *itemdef=NULL)
Definition inventory.cpp:71
bool operator==(const ItemStack &s) const
Definition inventory.h:171
const ToolCapabilities & getToolCapabilities(const IItemDefManager *itemdef) const
Definition inventory.h:105
const std::optional< WearBarParams > & getWearBarParams(const IItemDefManager *itemdef) const
Definition inventory.h:119
v3f getWieldScale(const IItemDefManager *itemdef) const
Definition inventory.cpp:295
void remove(u16 n)
Definition inventory.h:67
ItemStack addItem(ItemStack newitem, IItemDefManager *itemdef)
Definition inventory.cpp:304