Skip to content

Commit d7bb564

Browse files
committed
Fix BG create, stop and start related crashes
1 parent 29782a1 commit d7bb564

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/server/game/Battlegrounds/Battleground.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ Battleground::Battleground()
139139
Battleground::~Battleground()
140140
{
141141
#ifdef ELUNA
142-
if (Eluna* e = GetBgMap()->GetEluna())
143-
e->OnBGDestroy(this, GetTypeID(), GetInstanceID());
142+
if(m_Map)
143+
if (Eluna* e = m_Map->GetEluna())
144+
e->OnBGDestroy(this, GetTypeID(), GetInstanceID());
144145
#endif
145146

146147
// remove objects and creatures

src/server/game/Maps/MapInstanced.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
277277

278278
sScriptMgr->OnCreateMap(map);
279279

280+
#ifdef ELUNA
281+
if(Eluna* e = map->GetEluna())
282+
e->OnBGCreate(bg, bg->GetTypeID(), bg->GetInstanceID());
283+
#endif
284+
280285
return map;
281286
}
282287

src/server/game/Scripting/ScriptMgr.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,13 +1429,7 @@ void ScriptMgr::OnCreateMap(Map* map)
14291429

14301430
#ifdef ELUNA
14311431
if (Eluna* e = map->GetEluna())
1432-
{
14331432
e->OnCreate(map);
1434-
1435-
if (map->IsBattlegroundOrArena())
1436-
if (Battleground* bg = map->ToBattlegroundMap()->GetBG())
1437-
e->OnBGCreate(bg, bg->GetTypeID(), bg->GetInstanceID());
1438-
}
14391433
#endif
14401434

14411435
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);

0 commit comments

Comments
 (0)