Skip to content

Commit

Permalink
Fix crash on BG creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Feb 2, 2024
1 parent ff0850b commit 5cb2f0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,6 @@ void Battleground::StartBattleground()
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
sBattlegroundMgr->AddBattleground(this);

#ifdef ELUNA
if (Eluna* e = GetBgMap()->GetEluna())
e->OnBGCreate(this, GetTypeID(), GetInstanceID());
#endif

if (m_IsRated)
TC_LOG_DEBUG("bg.arena", "Arena match type: {} for Team1Id: {} - Team2Id: {} started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]);
}
Expand Down
10 changes: 10 additions & 0 deletions src/server/game/Maps/MapInstanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include "VMapManager2.h"
#include "World.h"

#ifdef ELUNA
#include "LuaEngine.h"
#endif

MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL)
{
// fill with zero
Expand Down Expand Up @@ -263,6 +267,12 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
bg->SetBgMap(map);

m_InstancedMaps[InstanceId] = map;

#ifdef ELUNA
if (Eluna* e = map->GetEluna())
e->OnBGCreate(bg, bg->GetTypeID(), InstanceId);
#endif

return map;
}

Expand Down

0 comments on commit 5cb2f0f

Please sign in to comment.