diff --git a/src/otclient/item.h b/src/otclient/item.h index 549ef09b..ffe99499 100644 --- a/src/otclient/item.h +++ b/src/otclient/item.h @@ -120,6 +120,7 @@ public: bool isItem() { return true; } void addContainerItem(const ItemPtr& i) { m_containerItems.push_back(i); } + void clearContainerItems() { m_containerItems.clear(); } const ThingTypePtr& getThingType(); ThingType *rawGetThingType(); diff --git a/src/otclient/itemtype.cpp b/src/otclient/itemtype.cpp index 3721d475..c0855dfe 100644 --- a/src/otclient/itemtype.cpp +++ b/src/otclient/itemtype.cpp @@ -41,7 +41,6 @@ void ItemType::unserialize(const BinaryTreePtr& node) node->getU32(); // flags static uint16 lastId = 99; - static ItemTypePtr nullType = g_things.getNullItemType(); while(node->canRead()) { uint8 attr = node->getU8(); if(attr == 0 || attr == 0xFF) @@ -54,9 +53,10 @@ void ItemType::unserialize(const BinaryTreePtr& node) if(serverId > 20000 && serverId < 20100) { serverId -= 20000; } else if(lastId > 99 && lastId != serverId - 1) { + static ItemType nullType; while(lastId != serverId - 1) { - nullType->setServerId(lastId++); - g_things.addItemType(nullType); + nullType.setServerId(lastId++); + g_things.addItemType(ItemTypePtr(&nullType)); } } setServerId(serverId);