aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-02-10 12:43:13 +0100
committerkaelima <kaelima@live.se>2012-02-10 12:43:13 +0100
commit03b27179318f7371d47808589f10131aa0887bd5 (patch)
treeecd1622a032c2f3b84274b43c22570a24dbc78f7 /src
parent5251daf01a9991c97d4e350397033da4f0231466 (diff)
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)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp2
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp3
-rwxr-xr-xsrc/server/game/Maps/Map.cpp3
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 891cf6b6697..a425640e36d 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -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)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index fc6c6cb063e..286605f0057 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -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)
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 71fc2ef00a1..6e13e70d1cd 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -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>
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6bd09f2b3a7..ab107fd0599 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -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