From 2127361148d4ea5531a115cc92131a3f956ca528 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Nov 2015 18:10:42 +0300 Subject: Allow add items to npc inventory from same slot multiple times. Added items automatically removed from inventory item amounts. --- src/inventory.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index 1d1f49ebe..995a8ef52 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -35,6 +35,8 @@ #include "enums/being/gender.h" +#include "utils/intmap.h" + #include #include @@ -174,15 +176,20 @@ class Inventory final int findIndexByTag(const int tag) const; - void addVirtualItem(const Item *const item, + bool addVirtualItem(const Item *const item, int index); + void virtualRemove(Item *const item, + const int amount); + + void restoreVirtuals(); protected: typedef std::list InventoryListenerList; InventoryListenerList mInventoryListeners; void distributeSlotsChangedEvent(); + IntMap mVirtualRemove; InventoryType::Type mType; unsigned mSize; /**< The max number of inventory items */ Item **mItems; /**< The holder of items */ -- cgit v1.2.3-60-g2f50