[8739] Call cleaniup code at remove player from Map before Map unlinking.

This fix crash when aura remove triggering spell casting.
This commit is contained in:
VladimirMangos 2009-10-26 15:18:27 +03:00
parent a22c0f05b9
commit 6cab460f6b
2 changed files with 6 additions and 11 deletions

View file

@ -722,6 +722,11 @@ void Map::Update(const uint32 &t_diff)
void Map::Remove(Player *player, bool remove)
{
if(remove)
player->CleanupsBeforeDelete();
else
player->RemoveFromWorld();
// this may be called during Map::Update
// after decrement+unlink, ++m_mapRefIter will continue correctly
// when the first element of the list is being removed
@ -733,11 +738,6 @@ void Map::Remove(Player *player, bool remove)
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
{
if(remove)
player->CleanupsBeforeDelete();
else
player->RemoveFromWorld();
// invalid coordinates
player->ResetMap();
@ -759,11 +759,6 @@ void Map::Remove(Player *player, bool remove)
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert(grid != NULL);
if(remove)
player->CleanupsBeforeDelete();
else
player->RemoveFromWorld();
RemoveFromGrid(player,grid,cell);
SendRemoveTransports(player);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8738"
#define REVISION_NR "8739"
#endif // __REVISION_NR_H__