From 7fae28ce9153c7d4e559cec766f37b3d41698893 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 20 Nov 2016 03:06:04 +0200 Subject: [PATCH] Prevent RemoveItem() script function from clearing inventorySendBuffer Up to this commit, the following commands in a Lua script led to the target player receiving all three items, as expected: tes3mp.AddItem(self.pid, "common_shirt_01", 1, -1) tes3mp.AddItem(self.pid, "common_pants_01", 1, -1) tes3mp.AddItem(self.pid, "common_shoes_01", 1, -1) tes3mp.SendInventory(self.pid) This, on the other hand, only led to the removal of the last item specified (in this case, the shoes): tes3mp.RemoveItem(self.pid, "common_shirt_01", 1) tes3mp.RemoveItem(self.pid, "common_pants_01", 1) tes3mp.RemoveItem(self.pid, "common_shoes_01", 1) tes3mp.SendInventory(self.pid) Inventory functions are bound to remain confusing, but they should at least be consistent in their behavior. --- apps/openmw-mp/Script/Functions/Items.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 25fa41e36..aa3dc2eb0 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -65,7 +65,6 @@ void ItemFunctions::RemoveItem(unsigned short pid, const char* itemName, unsigne item.refid = itemName; item.count = count; - player->inventorySendBuffer.items.clear(); player->inventorySendBuffer.items.push_back(item); player->inventorySendBuffer.action = Inventory::REMOVEITEM; }