aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectAccessor.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-13 21:36:26 -0500
committermegamage <none@none>2009-08-13 21:36:26 -0500
commit853f3a5ddd27c9a7d0e62499c5494701c0120df0 (patch)
treea2e15338d6fde74556def5b25253e232293c7414 /src/game/ObjectAccessor.cpp
parent93e420ed29dbf8c40bebf8e128a2f45002bcbf43 (diff)
*Fix a crash bug caused by corpse.
--HG-- branch : trunk
Diffstat (limited to 'src/game/ObjectAccessor.cpp')
-rw-r--r--src/game/ObjectAccessor.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 348490806b6..602e6eb5391 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -256,9 +256,14 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
{
assert(corpse && corpse->GetType() != CORPSE_BONES);
+ if(corpse->FindMap())
+ corpse->FindMap()->Remove(corpse, false);
+ else
+ corpse->RemoveFromWorld();
+
Guard guard(i_corpseGuard);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
- if( iter == i_player2corpse.end() )
+ if( iter == i_player2corpse.end() ) // i do not know when it happens but it happens
return;
// build mapid*cellid -> guid_set map
@@ -266,10 +271,6 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
objmgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID());
- if(corpse->FindMap())
- corpse->FindMap()->Remove(corpse, false);
- else
- corpse->RemoveFromWorld();
i_player2corpse.erase(iter);
}