summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-02 12:53:20 -0400
committerShadowNinja <shadowninja@minetest.net>2014-10-01 18:44:36 -0400
commite9c9b66ae92f4b95061d2b93e5db182d0c80b526 (patch)
tree11dadc5c6fff4e2060401e4cc552593ba6c53a8b /src/inventory.h
parent8b3135a64350a045dbb0b9a6ce1dad61cba0c532 (diff)
downloadminetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.tar.gz
minetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.tar.bz2
minetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.zip
Make players check inventory modification properly
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 52b776db3..d21a5deda 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -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