mirror of
https://github.com/mangosfour/server.git
synced 2025-12-22 04:37:01 +00:00
[11017] Finaly restore non-crashing non-in-world logout.
For example at close client with far teleport loading screen.
This commit is contained in:
parent
805d62bef1
commit
784c0ca781
6 changed files with 21 additions and 17 deletions
|
|
@ -476,9 +476,18 @@ 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
|
||||
Map* _map = _player->GetMap();
|
||||
_map->Remove(_player, true);
|
||||
SetPlayer(NULL); // deleted in Remove call
|
||||
if (_player->IsInWorld())
|
||||
{
|
||||
Map* _map = _player->GetMap();
|
||||
_map->Remove(_player, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->CleanupsBeforeDelete();
|
||||
Map::DeleteFromWorld(_player);
|
||||
}
|
||||
|
||||
SetPlayer(NULL); // deleted in Remove/DeleteFromWorld call
|
||||
|
||||
///- Send the 'logout complete' packet to the client
|
||||
WorldPacket data( SMSG_LOGOUT_COMPLETE, 0 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue