Fix segfault on exit
This commit is contained in:
parent
1ed95b6120
commit
a9fad4751f
|
@ -120,6 +120,7 @@ public:
|
||||||
bool isItem() { return true; }
|
bool isItem() { return true; }
|
||||||
|
|
||||||
void addContainerItem(const ItemPtr& i) { m_containerItems.push_back(i); }
|
void addContainerItem(const ItemPtr& i) { m_containerItems.push_back(i); }
|
||||||
|
void clearContainerItems() { m_containerItems.clear(); }
|
||||||
|
|
||||||
const ThingTypePtr& getThingType();
|
const ThingTypePtr& getThingType();
|
||||||
ThingType *rawGetThingType();
|
ThingType *rawGetThingType();
|
||||||
|
|
|
@ -41,7 +41,6 @@ void ItemType::unserialize(const BinaryTreePtr& node)
|
||||||
node->getU32(); // flags
|
node->getU32(); // flags
|
||||||
|
|
||||||
static uint16 lastId = 99;
|
static uint16 lastId = 99;
|
||||||
static ItemTypePtr nullType = g_things.getNullItemType();
|
|
||||||
while(node->canRead()) {
|
while(node->canRead()) {
|
||||||
uint8 attr = node->getU8();
|
uint8 attr = node->getU8();
|
||||||
if(attr == 0 || attr == 0xFF)
|
if(attr == 0 || attr == 0xFF)
|
||||||
|
@ -54,9 +53,10 @@ void ItemType::unserialize(const BinaryTreePtr& node)
|
||||||
if(serverId > 20000 && serverId < 20100) {
|
if(serverId > 20000 && serverId < 20100) {
|
||||||
serverId -= 20000;
|
serverId -= 20000;
|
||||||
} else if(lastId > 99 && lastId != serverId - 1) {
|
} else if(lastId > 99 && lastId != serverId - 1) {
|
||||||
|
static ItemType nullType;
|
||||||
while(lastId != serverId - 1) {
|
while(lastId != serverId - 1) {
|
||||||
nullType->setServerId(lastId++);
|
nullType.setServerId(lastId++);
|
||||||
g_things.addItemType(nullType);
|
g_things.addItemType(ItemTypePtr(&nullType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setServerId(serverId);
|
setServerId(serverId);
|
||||||
|
|
Loading…
Reference in New Issue