1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fixed some problems with crafting and inventory

This commit is contained in:
Perttu Ahola 2011-04-11 21:28:04 +03:00
parent 81ac026e1f
commit 249c0dc68a
6 changed files with 75 additions and 34 deletions

View file

@ -278,6 +278,7 @@ InventoryList::InventoryList(std::string name, u32 size)
m_name = name;
m_size = size;
clearItems();
//m_dirty = false;
}
InventoryList::~InventoryList()
@ -303,6 +304,8 @@ void InventoryList::clearItems()
{
m_items.push_back(NULL);
}
//setDirty(true);
}
void InventoryList::serialize(std::ostream &os)
@ -396,6 +399,7 @@ InventoryList & InventoryList::operator = (const InventoryList &other)
m_items[i] = item->clone();
}
}
//setDirty(true);
return *this;
}
@ -440,6 +444,7 @@ InventoryItem * InventoryList::changeItem(u32 i, InventoryItem *newitem)
InventoryItem *olditem = m_items[i];
m_items[i] = newitem;
//setDirty(true);
return olditem;
}
@ -493,6 +498,8 @@ InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem)
if(newitem == NULL)
return NULL;
//setDirty(true);
// If it is an empty position, it's an easy job.
InventoryItem *to_item = m_items[i];
if(to_item == NULL)
@ -549,6 +556,8 @@ InventoryItem * InventoryList::takeItem(u32 i, u32 count)
{
if(count == 0)
return NULL;
//setDirty(true);
InventoryItem *item = m_items[i];
// If it is an empty position, return NULL