From f4efa0f1df25aab4ed233c7fd3d536ef46d483ed Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 17 May 2009 09:28:38 -0500 Subject: *Fix a crash caused by bg and arena. --HG-- branch : trunk --- src/game/MapInstanced.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 0ac64b8f62e..df0fca8016c 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -121,21 +121,25 @@ Map* MapInstanced::GetInstance(const WorldObject* obj) Player* player = (Player*)obj; uint32 instanceId = player->GetInstanceId(); + if(instanceId) + if(Map *map = _FindMap(instanceId)) + return map; + if(IsBattleGroundOrArena()) { - if(!instanceId) - instanceId = player->GetBattleGroundId(); + instanceId = player->GetBattleGroundId(); if(instanceId) - return _FindMap(instanceId); + { + if(Map *map = _FindMap(instanceId)) + return map; + else + return CreateBattleGround(instanceId); + } else return NULL; } - if(instanceId) - if(Map *map = _FindMap(instanceId)) - return map; - InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDifficulty()); InstanceSave *pSave = pBind ? pBind->save : NULL; if(!pBind || !pBind->perm) -- cgit v1.2.3