Only read and delete from corpse table for current map instance. Not for

all. Prevents assert stop upon entering an instance on second character
after first one is a corpse in the same dungeon on different instance ID.
This commit is contained in:
pete318 authored and roc13x committed 2017-04-01 19:41:03 +01:00
1 parent 16f8bb7b1e
commit 4d65596f0d
2 files changed
+11 -7

No files matched your search

+8 -4
View File
@@ -3628,9 +3628,10 @@ void Map::LoadCorpseData()
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, GetInstanceId());
// 0, 1
// SELECT Guid, PhaseId FROM corpse_phases
// 0 1
// SELECT OwnerGuid, PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
PreparedQueryResult phaseResult = CharacterDatabase.Query(stmt);
if (phaseResult)
{
@@ -3646,9 +3647,10 @@ void Map::LoadCorpseData()
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, GetInstanceId());
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ?
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
return;
@@ -3680,8 +3682,10 @@ void Map::LoadCorpseData()
void Map::DeleteCorpseData()
{
// DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSES_FROM_MAP);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, GetInstanceId());
CharacterDatabase.Execute(stmt);
}