mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/LFG: Fix Leader flag being ignored
Fix bug added in 5ca00bc14d that removed Leader flag of LFG without ever adding it back, giving leadership to players who didn't want it.
This commit is contained in:
@@ -770,10 +770,9 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& playe
|
||||
Check if a group can be formed with the given group roles
|
||||
|
||||
@param[in] groles Map of roles to check
|
||||
@param[in] removeLeaderFlag Determines if we have to remove leader flag (only used first call, Default = true)
|
||||
@return True if roles are compatible
|
||||
*/
|
||||
bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/)
|
||||
bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles)
|
||||
{
|
||||
if (groles.empty())
|
||||
return false;
|
||||
@@ -782,21 +781,18 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
|
||||
uint8 tank = 0;
|
||||
uint8 healer = 0;
|
||||
|
||||
if (removeLeaderFlag)
|
||||
for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
|
||||
it->second &= ~PLAYER_ROLE_LEADER;
|
||||
|
||||
for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
|
||||
{
|
||||
if (it->second == PLAYER_ROLE_NONE)
|
||||
uint8 role = it->second & ~PLAYER_ROLE_LEADER;
|
||||
if (role == PLAYER_ROLE_NONE)
|
||||
return false;
|
||||
|
||||
if (it->second & PLAYER_ROLE_DAMAGE)
|
||||
if (role & PLAYER_ROLE_DAMAGE)
|
||||
{
|
||||
if (it->second != PLAYER_ROLE_DAMAGE)
|
||||
if (role != PLAYER_ROLE_DAMAGE)
|
||||
{
|
||||
it->second -= PLAYER_ROLE_DAMAGE;
|
||||
if (CheckGroupRoles(groles, false))
|
||||
if (CheckGroupRoles(groles))
|
||||
return true;
|
||||
it->second += PLAYER_ROLE_DAMAGE;
|
||||
}
|
||||
@@ -806,12 +802,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
|
||||
damage++;
|
||||
}
|
||||
|
||||
if (it->second & PLAYER_ROLE_HEALER)
|
||||
if (role & PLAYER_ROLE_HEALER)
|
||||
{
|
||||
if (it->second != PLAYER_ROLE_HEALER)
|
||||
if (role != PLAYER_ROLE_HEALER)
|
||||
{
|
||||
it->second -= PLAYER_ROLE_HEALER;
|
||||
if (CheckGroupRoles(groles, false))
|
||||
if (CheckGroupRoles(groles))
|
||||
return true;
|
||||
it->second += PLAYER_ROLE_HEALER;
|
||||
}
|
||||
@@ -821,12 +817,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
|
||||
healer++;
|
||||
}
|
||||
|
||||
if (it->second & PLAYER_ROLE_TANK)
|
||||
if (role & PLAYER_ROLE_TANK)
|
||||
{
|
||||
if (it->second != PLAYER_ROLE_TANK)
|
||||
if (role != PLAYER_ROLE_TANK)
|
||||
{
|
||||
it->second -= PLAYER_ROLE_TANK;
|
||||
if (CheckGroupRoles(groles, false))
|
||||
if (CheckGroupRoles(groles))
|
||||
return true;
|
||||
it->second += PLAYER_ROLE_TANK;
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ class LFGMgr
|
||||
/// Checks if all players are queued
|
||||
bool AllQueued(GuidList const& check);
|
||||
/// Checks if given roles match, modifies given roles map with new roles
|
||||
static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
static bool CheckGroupRoles(LfgRolesMap &groles);
|
||||
/// Checks if given players are ignoring each other
|
||||
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
|
||||
/// Sends queue status to player
|
||||
|
||||
Reference in New Issue
Block a user