mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +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
|
|
@ -182,14 +182,6 @@ void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
|
|||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Map::DeleteFromWorld(T* obj)
|
||||
{
|
||||
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
||||
delete obj;
|
||||
}
|
||||
|
||||
template<>
|
||||
void Map::DeleteFromWorld(Player* pl)
|
||||
{
|
||||
sObjectAccessor.RemoveObject(pl);
|
||||
|
|
@ -660,7 +652,9 @@ Map::Remove(T *obj, bool remove)
|
|||
// if option set then object already saved at this moment
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY))
|
||||
obj->SaveRespawnTime();
|
||||
DeleteFromWorld(obj);
|
||||
|
||||
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
template<class T> void Add(T *);
|
||||
template<class T> void Remove(T *, bool);
|
||||
|
||||
static void DeleteFromWorld(Player* player); // player object will deleted at call
|
||||
|
||||
virtual void Update(const uint32&);
|
||||
|
||||
void MessageBroadcast(Player *, WorldPacket *, bool to_self);
|
||||
|
|
@ -320,9 +322,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
|
||||
template<class T>
|
||||
void RemoveFromGrid(T*, NGridType *, Cell const&);
|
||||
|
||||
template<class T>
|
||||
void DeleteFromWorld(T*);
|
||||
};
|
||||
|
||||
class MANGOS_DLL_SPEC InstanceMap : public Map
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
" (map:%u, x:%f, y:%f, z:%f) Trying to port him to his previous place..",
|
||||
GetPlayer()->GetGuidStr().c_str(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
|
||||
|
||||
GetPlayer()->SetSemaphoreTeleportFar(false);
|
||||
|
||||
// Teleport to previous place, if cannot be ported back TP to homebind place
|
||||
if (!GetPlayer()->TeleportTo(old_loc))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17049,7 +17049,7 @@ void Player::SaveToDB()
|
|||
|
||||
ss << uint32(m_atLoginFlags) << ", ";
|
||||
|
||||
ss << GetZoneId() << ", ";
|
||||
ss << (IsInWorld() ? GetZoneId() : GetCachedZoneId()) << ", ";
|
||||
|
||||
ss << (uint64)m_deathExpireTime << ", '";
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11016"
|
||||
#define REVISION_NR "11017"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue