diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 54f5a750fbb..7a8205395f9 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1404,48 +1404,55 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag /*= true for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it) { - switch(it->second) - { - case ROLE_NONE: + if (it->second == ROLE_NONE) return false; - case ROLE_TANK: - if (tank == LFG_TANKS_NEEDED) - return false; - tank++; - break; - case ROLE_HEALER: - if (healer == LFG_HEALERS_NEEDED) - return false; - healer++; - break; - case ROLE_DAMAGE: - if (damage == LFG_DPS_NEEDED) + + if (it->second & ROLE_TANK) + { + if (tank == LFG_TANKS_NEEDED) return false; - damage++; - break; - default: - if (it->second & ROLE_TANK) + + if (it->second != ROLE_TANK) { it->second -= ROLE_TANK; if (CheckGroupRoles(groles, false)) return true; it->second += ROLE_TANK; } + else + tank++; + } - if (it->second & ROLE_HEALER) + if (it->second & ROLE_HEALER) + { + if (healer == LFG_HEALERS_NEEDED) + return false; + + if (it->second != ROLE_HEALER) { it->second -= ROLE_HEALER; if (CheckGroupRoles(groles, false)) return true; it->second += ROLE_HEALER; } + else + healer++; + } + + if (it->second & ROLE_DAMAGE) + { + if (damage == LFG_DPS_NEEDED) + return false; - if (it->second & ROLE_DAMAGE) + if (it->second != ROLE_DAMAGE) { it->second -= ROLE_DAMAGE; - return CheckGroupRoles(groles, false); + if (CheckGroupRoles(groles, false)) + return true; + it->second += ROLE_DAMAGE; } - break; + else + damage++; } } return true; |