mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make players check inventory modification properly
This commit is contained in:
parent
8b3135a643
commit
e9c9b66ae9
6 changed files with 39 additions and 9 deletions
|
@ -279,18 +279,30 @@ public:
|
|||
// A shorthand for adding items. Returns leftover item (possibly empty).
|
||||
ItemStack addItem(const std::string &listname, const ItemStack &newitem)
|
||||
{
|
||||
m_dirty = true;
|
||||
InventoryList *list = getList(listname);
|
||||
if(list == NULL)
|
||||
return newitem;
|
||||
return list->addItem(newitem);
|
||||
}
|
||||
|
||||
|
||||
bool checkModified() const
|
||||
{
|
||||
return m_dirty;
|
||||
}
|
||||
|
||||
void setModified(const bool x)
|
||||
{
|
||||
m_dirty = x;
|
||||
}
|
||||
|
||||
private:
|
||||
// -1 if not found
|
||||
const s32 getListIndex(const std::string &name) const;
|
||||
|
||||
std::vector<InventoryList*> m_lists;
|
||||
IItemDefManager *m_itemdef;
|
||||
bool m_dirty;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue