summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
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.cpp
parent8b3135a64350a045dbb0b9a6ce1dad61cba0c532 (diff)
downloadminetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.tar.gz
minetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.tar.bz2
minetest-e9c9b66ae92f4b95061d2b93e5db182d0c80b526.zip
Make players check inventory modification properly
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 4766524dd..cecef01a0 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -831,6 +831,7 @@ Inventory::~Inventory()
void Inventory::clear()
{
+ m_dirty = true;
for(u32 i=0; i<m_lists.size(); i++)
{
delete m_lists[i];
@@ -840,6 +841,7 @@ void Inventory::clear()
void Inventory::clearContents()
{
+ m_dirty = true;
for(u32 i=0; i<m_lists.size(); i++)
{
InventoryList *list = m_lists[i];
@@ -852,12 +854,14 @@ void Inventory::clearContents()
Inventory::Inventory(IItemDefManager *itemdef)
{
+ m_dirty = false;
m_itemdef = itemdef;
}
Inventory::Inventory(const Inventory &other)
{
*this = other;
+ m_dirty = false;
}
Inventory & Inventory::operator = (const Inventory &other)
@@ -865,6 +869,7 @@ Inventory & Inventory::operator = (const Inventory &other)
// Gracefully handle self assignment
if(this != &other)
{
+ m_dirty = true;
clear();
m_itemdef = other.m_itemdef;
for(u32 i=0; i<other.m_lists.size(); i++)
@@ -945,6 +950,7 @@ void Inventory::deSerialize(std::istream &is)
InventoryList * Inventory::addList(const std::string &name, u32 size)
{
+ m_dirty = true;
s32 i = getListIndex(name);
if(i != -1)
{
@@ -990,6 +996,7 @@ bool Inventory::deleteList(const std::string &name)
s32 i = getListIndex(name);
if(i == -1)
return false;
+ m_dirty = true;
delete m_lists[i];
m_lists.erase(m_lists.begin() + i);
return true;