mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Dungeon Finder: Fix role check algorithm (Some valid combinations were being marked as invalid)
--HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||
|
||||
if (it->second & 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)
|
||||
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 (it->second & ROLE_DAMAGE)
|
||||
{
|
||||
if (damage == LFG_DPS_NEEDED)
|
||||
return false;
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user