fix(Core/LFG): Fix Leader flag being ignored (#23239)

This commit is contained in:
天鹭
2025-10-17 12:09:10 +08:00
committed by GitHub
parent 1243fdd1d8
commit 762f5a7158
2 changed files with 13 additions and 16 deletions
+12 -15
View File
@@ -1508,7 +1508,7 @@ namespace lfg
lockMap.clear(); lockMap.clear();
} }
uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/) uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles)
{ {
if (groles.empty()) if (groles.empty())
return 0; return 0;
@@ -1517,21 +1517,18 @@ namespace lfg
uint8 tank = 0; uint8 tank = 0;
uint8 healer = 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) for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
{ {
if (it->second == PLAYER_ROLE_NONE) uint8 const role = it->second & ~PLAYER_ROLE_LEADER;
if (role == PLAYER_ROLE_NONE)
return 0; return 0;
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; it->second -= PLAYER_ROLE_DAMAGE;
if (uint8 x = CheckGroupRoles(groles, false)) if (uint8 x = CheckGroupRoles(groles))
return x; return x;
it->second += PLAYER_ROLE_DAMAGE; it->second += PLAYER_ROLE_DAMAGE;
} }
@@ -1541,12 +1538,12 @@ namespace lfg
damage++; 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; it->second -= PLAYER_ROLE_HEALER;
if (uint8 x = CheckGroupRoles(groles, false)) if (uint8 x = CheckGroupRoles(groles))
return x; return x;
it->second += PLAYER_ROLE_HEALER; it->second += PLAYER_ROLE_HEALER;
} }
@@ -1556,12 +1553,12 @@ namespace lfg
healer++; 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; it->second -= PLAYER_ROLE_TANK;
if (uint8 x = CheckGroupRoles(groles, false)) if (uint8 x = CheckGroupRoles(groles))
return x; return x;
it->second += PLAYER_ROLE_TANK; it->second += PLAYER_ROLE_TANK;
} }
+1 -1
View File
@@ -568,7 +568,7 @@ namespace lfg
/// Checks if all players are queued /// Checks if all players are queued
bool AllQueued(Lfg5Guids const& check); bool AllQueued(Lfg5Guids const& check);
/// Checks if given roles match, modifies given roles map with new roles /// Checks if given roles match, modifies given roles map with new roles
static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true); static uint8 CheckGroupRoles(LfgRolesMap& groles);
/// Checks if given players are ignoring each other /// Checks if given players are ignoring each other
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2); static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
/// Sends queue status to player /// Sends queue status to player