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:
kaelima
2012-02-10 12:43:13 +01:00
parent 5251daf01a
commit 03b2717931
4 changed files with 6 additions and 6 deletions
@@ -496,7 +496,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
ResetMap(); ResetMap();
Map* newMap = sMapMgr->CreateBaseMap(newMapid); Map* newMap = sMapMgr->CreateBaseMap(newMapid);
SetMap(newMap); SetMap(newMap);
ASSERT (GetMap()); ASSERT(GetMap());
AddToWorld(); AddToWorld();
if (oldMap != newMap) if (oldMap != newMap)
+1 -2
View File
@@ -433,8 +433,7 @@ void Vehicle::RemovePassenger(Unit* unit)
void Vehicle::RelocatePassengers(float x, float y, float z, float ang) void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
{ {
Map* map = _me->GetMap(); ASSERT(_me->IsInWorld());
ASSERT(map != NULL);
// not sure that absolute position calculation is correct, it must depend on vehicle orientation and pitch angle // 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) for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
+2 -1
View File
@@ -668,7 +668,8 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
if (remove) if (remove)
DeleteFromWorld(player); DeleteFromWorld(player);
sScriptMgr->OnPlayerLeaveMap(this, player); if (remove)
sScriptMgr->OnPlayerLeaveMap(this, player);
} }
template<class T> template<class T>
+2 -2
View File
@@ -519,8 +519,8 @@ void WorldSession::LogoutPlayer(bool Save)
// calls to GetMap in this case may cause crashes // calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete(); _player->CleanupsBeforeDelete();
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow()); sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow());
Map* _map = _player->GetMap(); if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true); _map->RemovePlayerFromMap(_player, true);
SetPlayer(NULL); // deleted in Remove call SetPlayer(NULL); // deleted in Remove call
///- Send the 'logout complete' packet to the client ///- Send the 'logout complete' packet to the client