mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 15:17:27 +01:00
@@ -157,6 +157,12 @@ Battleground::~Battleground()
|
||||
m_Map->SetBG(nullptr);
|
||||
m_Map = nullptr;
|
||||
}
|
||||
|
||||
// Clear Group::m_bgGroup, Group might later reference it in its own destructor
|
||||
for (Group* bgRaid : m_BgRaids)
|
||||
if (bgRaid)
|
||||
bgRaid->SetBattlegroundGroup(nullptr);
|
||||
|
||||
// remove from bg free slot queue
|
||||
RemoveFromBGFreeSlotQueue();
|
||||
|
||||
|
||||
@@ -325,6 +325,7 @@ class TC_GAME_API Battleground
|
||||
|
||||
void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available
|
||||
void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available
|
||||
void RemoveFromBGFreeSlotQueueOnShutdown() { m_InBGFreeSlotQueue = false; }
|
||||
|
||||
void DecreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; }
|
||||
void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
|
||||
|
||||
@@ -70,6 +70,10 @@ BattlegroundMgr::~BattlegroundMgr()
|
||||
|
||||
void BattlegroundMgr::DeleteAllBattlegrounds()
|
||||
{
|
||||
for (auto& [_, data] : bgDataStore)
|
||||
for (Battleground* battleground : data.BGFreeSlotQueue)
|
||||
battleground->RemoveFromBGFreeSlotQueueOnShutdown();
|
||||
|
||||
bgDataStore.clear();
|
||||
}
|
||||
|
||||
@@ -904,13 +908,12 @@ void BattlegroundMgr::AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battlegr
|
||||
|
||||
void BattlegroundMgr::RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
{
|
||||
BGFreeSlotQueueContainer& queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
|
||||
for (BGFreeSlotQueueContainer::iterator itr = queues.begin(); itr != queues.end(); ++itr)
|
||||
if ((*itr)->GetInstanceID() == instanceId)
|
||||
{
|
||||
queues.erase(itr);
|
||||
return;
|
||||
}
|
||||
if (BattlegroundData* battlegroundData = Trinity::Containers::MapGetValuePtr(bgDataStore, bgTypeId))
|
||||
{
|
||||
auto itr = std::ranges::find(battlegroundData->BGFreeSlotQueue, instanceId, [](Battleground const* bg) { return bg->GetInstanceID(); });
|
||||
if (itr != battlegroundData->BGFreeSlotQueue.end())
|
||||
battlegroundData->BGFreeSlotQueue.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::AddBattleground(Battleground* bg)
|
||||
|
||||
Reference in New Issue
Block a user