aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);
}