aboutsummaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index fc1aaf371..b3bed623a 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -938,19 +938,16 @@ void Inventory::deSerialize(std::istream &is)
InventoryList * Inventory::addList(const std::string &name, u32 size)
{
setModified();
+
+ // Remove existing lists
s32 i = getListIndex(name);
- if(i != -1)
- {
- if(m_lists[i]->getSize() != size)
- {
- delete m_lists[i];
- m_lists[i] = new InventoryList(name, size, m_itemdef);
- m_lists[i]->setModified();
- }
+ if (i != -1) {
+ delete m_lists[i];
+ m_lists[i] = new InventoryList(name, size, m_itemdef);
+ m_lists[i]->setModified();
return m_lists[i];
}
-
//don't create list with invalid name
if (name.find(' ') != std::string::npos)
return nullptr;