aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp28
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h2
2 files changed, 13 insertions, 17 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index c1f2fe33889..ac6de073543 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -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;
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index b75686945a5..e368791c134 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -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