Skip to content

Commit 1d3f5af

Browse files
committedAug 25, 2019
Inventory: Fix missing setModified calls
Previously inv:remove_item and inv:set_list did not trigger an inventory update
1 parent b53a60c commit 1d3f5af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/inventory.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,8 @@ ItemStack InventoryList::removeItem(const ItemStack &item)
685685
break;
686686
}
687687
}
688+
if (!removed.empty())
689+
setModified();
688690
return removed;
689691
}
690692

@@ -936,15 +938,18 @@ InventoryList * Inventory::addList(const std::string &name, u32 size)
936938
{
937939
delete m_lists[i];
938940
m_lists[i] = new InventoryList(name, size, m_itemdef);
941+
m_lists[i]->setModified();
939942
}
940943
return m_lists[i];
941944
}
942945

943946

944947
//don't create list with invalid name
945-
if (name.find(' ') != std::string::npos) return NULL;
948+
if (name.find(' ') != std::string::npos)
949+
return nullptr;
946950

947951
InventoryList *list = new InventoryList(name, size, m_itemdef);
952+
list->setModified();
948953
m_lists.push_back(list);
949954
return list;
950955
}

0 commit comments

Comments
 (0)