Fix segfault on exit

This commit is contained in:
niczkx 2012-08-19 17:20:20 +00:00
parent 1ed95b6120
commit a9fad4751f
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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);