Skip to content

Commit

Permalink
Inventory: Fix missing setModified calls
Browse files Browse the repository at this point in the history
Previously inv:remove_item and inv:set_list did not trigger an inventory update
  • Loading branch information
SmallJoker committed Aug 25, 2019
1 parent b53a60c commit 1d3f5af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@ ItemStack InventoryList::removeItem(const ItemStack &item)
break;
}
}
if (!removed.empty())
setModified();
return removed;
}

Expand Down Expand Up @@ -936,15 +938,18 @@ InventoryList * Inventory::addList(const std::string &name, u32 size)
{
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 NULL;
if (name.find(' ') != std::string::npos)
return nullptr;

InventoryList *list = new InventoryList(name, size, m_itemdef);
list->setModified();
m_lists.push_back(list);
return list;
}
Expand Down

0 comments on commit 1d3f5af

Please sign in to comment.