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:
jackpoz
2014-10-07 22:15:01 +02:00
parent def151bb18
commit db88bf02b5
2 changed files with 13 additions and 17 deletions

View File

@@ -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;
}

View File

@@ -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