From f4efa0f1df25aab4ed233c7fd3d536ef46d483ed Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 17 May 2009 09:28:38 -0500 Subject: [PATCH] *Fix a crash caused by bg and arena. --HG-- branch : trunk --- src/game/MapInstanced.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) 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(IsBattleGroundOrArena()) - { - if(!instanceId) - instanceId = player->GetBattleGroundId(); - - if(instanceId) - return _FindMap(instanceId); - else - return NULL; - } - if(instanceId) if(Map *map = _FindMap(instanceId)) return map; + if(IsBattleGroundOrArena()) + { + instanceId = player->GetBattleGroundId(); + + if(instanceId) + { + if(Map *map = _FindMap(instanceId)) + return map; + else + return CreateBattleGround(instanceId); + } + else + return NULL; + } + InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDifficulty()); InstanceSave *pSave = pBind ? pBind->save : NULL; if(!pBind || !pBind->perm)