diff options
author | megamage <none@none> | 2009-08-26 18:11:14 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-26 18:11:14 -0500 |
commit | 185219d0879c1cac563b3f87d1f8fa034f80f695 (patch) | |
tree | f7b2a44861c69c6fc5b417d06a06b0f43de7de16 /src | |
parent | 3cf8ae345c918faef9b01acfa78371d539e24ea2 (diff) |
*Try to fix a crash caused by corpse. Thanks to new001.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/InstanceSaveMgr.cpp | 16 | ||||
-rw-r--r-- | src/game/ObjectGridLoader.cpp | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index d45e3fac451..2c3161e2faf 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -309,7 +309,7 @@ void InstanceSaveManager::CleanupInstances() delete result; } - // gameobject_respawn + // characters result = CharacterDatabase.Query("SELECT DISTINCT(instance_id) FROM characters WHERE instance_id <> 0"); if( result ) { @@ -323,6 +323,20 @@ void InstanceSaveManager::CleanupInstances() delete result; } + // corpse + result = CharacterDatabase.Query("SELECT DISTINCT(instance) FROM corpse WHERE instance <> 0"); + if( result ) + { + do + { + Field *fields = result->Fetch(); + if(InstanceSet.find(fields[0].GetUInt32()) == InstanceSet.end()) + CharacterDatabase.PExecute("UPDATE corpse SET instance = '0' WHERE instance = '%u'", fields[0].GetUInt32()); + } + while (result->NextRow()); + delete result; + } + bar.step(); sLog.outString(); sLog.outString( ">> Initialized %u instances", (uint32)InstanceSet.size()); diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index db08590b354..6a11fe44f86 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -157,6 +157,8 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType // TODO: this is a hack // corpse's map should be reset when the map is unloaded + // but it may still exist when the grid is unloaded but map is not + // in that case map == currMap obj->SetMap(map); AddObjectHelper(cell, m, count, map, obj); |