diff options
author | Spp <none@none> | 2010-11-23 15:01:15 +0100 |
---|---|---|
committer | Spp <none@none> | 2010-11-23 15:01:15 +0100 |
commit | 4dcdb396adb73325fb439a5c872790e792ebca72 (patch) | |
tree | 03e7786a826d82b4c18c39d3b5e084e3904383d3 /src | |
parent | 9ec77e0b63888da1c2917f3226ee4d3413e506ff (diff) |
Core/Dungeon Finder: Fix role check algorithm (Some valid combinations were being marked as invalid)
--HG--
branch : trunk
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; |