AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BattlegroundQueue::SelectionPool Class Reference

#include "BattlegroundQueue.h"

Public Member Functions

 SelectionPool ()
 
void Init ()
 
bool AddGroup (GroupQueueInfo *ginfo, uint32 desiredCount)
 
bool KickGroup (uint32 size)
 
uint32 GetPlayerCount () const
 

Public Attributes

GroupsQueueType SelectedGroups
 

Private Attributes

uint32 PlayerCount
 

Detailed Description

Constructor & Destructor Documentation

◆ SelectionPool()

BattlegroundQueue::SelectionPool::SelectionPool ( )
inline
114: PlayerCount(0) {};
uint32 PlayerCount
Definition BattlegroundQueue.h:122

Member Function Documentation

◆ AddGroup()

bool BattlegroundQueue::SelectionPool::AddGroup ( GroupQueueInfo ginfo,
uint32  desiredCount 
)
118{
119 // add if we don't exceed desiredCount
120 if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
121 {
122 SelectedGroups.push_back(ginfo);
123 PlayerCount += ginfo->Players.size();
124 return true;
125 }
126 return PlayerCount < desiredCount;
127}
GroupsQueueType SelectedGroups
Definition BattlegroundQueue.h:120
uint32 IsInvitedToBGInstanceGUID
Definition BattlegroundQueue.h:41
GuidSet Players
Definition BattlegroundQueue.h:32

References GroupQueueInfo::IsInvitedToBGInstanceGUID, and GroupQueueInfo::Players.

Referenced by BattlegroundQueue::CheckNormalMatch(), BattlegroundQueue::CheckPremadeMatch(), BattlegroundQueue::CheckSkirmishForSameFaction(), and BattlegroundQueue::FillPlayersToBG().

◆ GetPlayerCount()

uint32 BattlegroundQueue::SelectionPool::GetPlayerCount ( ) const
inline
118{ return PlayerCount; }

References PlayerCount.

Referenced by BattlegroundQueue::CheckNormalMatch().

◆ Init()

void BattlegroundQueue::SelectionPool::Init ( )

◆ KickGroup()

bool BattlegroundQueue::SelectionPool::KickGroup ( uint32  size)
85{
86 if (SelectedGroups.empty())
87 return false;
88
89 // find last group with proper size or largest
90 bool foundProper = false;
91 GroupQueueInfo* groupToKick{ SelectedGroups.front() };
92
93 for (auto const& gInfo : SelectedGroups)
94 {
95 // if proper size - overwrite to kick last one
96 if (std::abs(int32(gInfo->Players.size()) - (int32)size) <= 1)
97 {
98 groupToKick = gInfo;
99 foundProper = true;
100 }
101 else if (!foundProper && gInfo->Players.size() >= groupToKick->Players.size())
102 groupToKick = gInfo;
103 }
104
105 // remove selected from pool
106 auto playersCountInGroup{ groupToKick->Players.size() };
107 PlayerCount -= playersCountInGroup;
108 std::erase(SelectedGroups, groupToKick);
109
110 if (foundProper)
111 return false;
112
113 return playersCountInGroup > size;
114}
std::int32_t int32
Definition Define.h:103
Definition BattlegroundQueue.h:31

References GroupQueueInfo::Players.

Referenced by BattlegroundQueue::FillPlayersToBG().

Member Data Documentation

◆ PlayerCount

uint32 BattlegroundQueue::SelectionPool::PlayerCount
private

Referenced by GetPlayerCount(), and Init().

◆ SelectedGroups


The documentation for this class was generated from the following files: