Core/Map:
- Fixed crash when a player was disconnected during a transfer to another map. - Only call OnPlayerLeaveMap if player is removed from map. (Ty QAston)
This commit is contained in:
@@ -496,7 +496,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
||||
ResetMap();
|
||||
Map* newMap = sMapMgr->CreateBaseMap(newMapid);
|
||||
SetMap(newMap);
|
||||
ASSERT (GetMap());
|
||||
ASSERT(GetMap());
|
||||
AddToWorld();
|
||||
|
||||
if (oldMap != newMap)
|
||||
|
||||
@@ -433,8 +433,7 @@ void Vehicle::RemovePassenger(Unit* unit)
|
||||
|
||||
void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
|
||||
{
|
||||
Map* map = _me->GetMap();
|
||||
ASSERT(map != NULL);
|
||||
ASSERT(_me->IsInWorld());
|
||||
|
||||
// not sure that absolute position calculation is correct, it must depend on vehicle orientation and pitch angle
|
||||
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
|
||||
|
||||
@@ -668,7 +668,8 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
|
||||
if (remove)
|
||||
DeleteFromWorld(player);
|
||||
|
||||
sScriptMgr->OnPlayerLeaveMap(this, player);
|
||||
if (remove)
|
||||
sScriptMgr->OnPlayerLeaveMap(this, player);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -519,8 +519,8 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
// calls to GetMap in this case may cause crashes
|
||||
_player->CleanupsBeforeDelete();
|
||||
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow());
|
||||
Map* _map = _player->GetMap();
|
||||
_map->RemovePlayerFromMap(_player, true);
|
||||
if (Map* _map = _player->FindMap())
|
||||
_map->RemovePlayerFromMap(_player, true);
|
||||
SetPlayer(NULL); // deleted in Remove call
|
||||
|
||||
///- Send the 'logout complete' packet to the client
|
||||
|
||||
Reference in New Issue
Block a user