diff options
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 28 |
1 files changed, 12 insertions, 16 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; } |