don't free and reallocate inventory items for no reason

This commit is contained in:
darkrose 2015-02-24 17:15:50 +10:00
parent 32a4d290da
commit 2c1be5a6e7
1 changed files with 2 additions and 7 deletions

View File

@ -440,13 +440,8 @@ void InventoryList::deSerialize(std::istream &is)
}
if (m_items[item_i] != NULL) {
if (m_items[item_i]->getContent() == c) {
if ((c&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) {
((ToolItem*)m_items[item_i++])->setWear(wear);
}else if ((c&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK) {
((ClothesItem*)m_items[item_i++])->setWear(wear);
}else{
m_items[item_i]->setWear(wear);
m_items[item_i++]->setCount(count);
}
continue;
}
delete m_items[item_i];