*Cleanup about deleting player.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-10 23:32:20 -05:00
parent 4ecbefabfa
commit 31374835f6
4 changed files with 6 additions and 20 deletions
@@ -784,12 +784,6 @@ void LoadOverridenDBCData()
case 41013:
spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
break;
//temp, not needed in 310
case 28531:
case 55799:
spellInfo->DurationIndex = 21;
spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AREA_AURA_ENEMY;
break;
// Naxxramas : Gothik : Inform Inf range
case 27892:
case 27928:
+4 -10
View File
@@ -202,7 +202,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0),
m_activeNonPlayersIter(m_activeNonPlayers.end()),
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this)
, i_lock(true)
, i_lock(false)
{
m_notifyTimer.SetInterval(IN_MILISECONDS/2);
@@ -665,6 +665,8 @@ void Map::RemoveUnitFromNotify(Unit *unit, int32 slot)
assert(slot < i_unitsToNotify.size());
i_unitsToNotify[slot] = NULL;
}
unit->m_NotifyListPos = -1;
}
void Map::Update(const uint32 &t_diff)
@@ -816,17 +818,12 @@ void Map::Remove(Player *player, bool remove)
CellPair p = Trinity::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();
sLog.outCrash("Map::Remove: Player is in invalid cell!");
// invalid coordinates
player->RemoveFromWorld();
if( remove )
{
player->ResetMap();
DeleteFromWorld(player);
}
return;
}
@@ -843,9 +840,6 @@ void Map::Remove(Player *player, bool remove)
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert(grid != NULL);
if(remove)
player->CleanupsBeforeDelete();
player->RemoveFromWorld();
RemoveFromGrid(player,grid,cell);
+1 -4
View File
@@ -12393,10 +12393,7 @@ void Unit::RemoveFromWorld()
RemoveAllControlled();
if(m_NotifyListPos >= 0)
{
GetMap()->RemoveUnitFromNotify(this, m_NotifyListPos);
m_NotifyListPos = -1;
}
if(GetCharmerGUID())
{
@@ -15186,7 +15183,7 @@ void Unit::SendThreatListUpdate()
{
if (uint32 count = getThreatManager().getThreatList().size())
{
sLog.outDebug( "WORLD: Send SMSG_THREAT_UPDATE Message" );
//sLog.outDebug( "WORLD: Send SMSG_THREAT_UPDATE Message" );
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data.append(GetPackGUID());
data << uint32(count);
+1
View File
@@ -387,6 +387,7 @@ void WorldSession::LogoutPlayer(bool Save)
// the player may not be in the world when logging out
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete();
Map* _map = _player->GetMap();
_map->Remove(_player, true);
_player = NULL; // deleted in Remove call