From 762f5a7158d38857d09c29784c119a2af7fcad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E9=B9=AD?= <18535853+PkllonG@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:09:10 +0800 Subject: [PATCH] fix(Core/LFG): Fix Leader flag being ignored (#23239) --- src/server/game/DungeonFinding/LFGMgr.cpp | 27 ++++++++++------------- src/server/game/DungeonFinding/LFGMgr.h | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 2449fada7..0d4e6a27b 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1508,7 +1508,7 @@ namespace lfg lockMap.clear(); } - uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/) + uint8 LFGMgr::CheckGroupRoles(LfgRolesMap& groles) { if (groles.empty()) return 0; @@ -1517,21 +1517,18 @@ namespace lfg 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 const role = it->second & ~PLAYER_ROLE_LEADER; + if (role == PLAYER_ROLE_NONE) 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; - if (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_DAMAGE; } @@ -1541,12 +1538,12 @@ namespace lfg 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 (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_HEALER; } @@ -1556,12 +1553,12 @@ namespace lfg 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 (uint8 x = CheckGroupRoles(groles, false)) + if (uint8 x = CheckGroupRoles(groles)) return x; it->second += PLAYER_ROLE_TANK; } diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 0eb27e71c..235689bca 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -568,7 +568,7 @@ namespace lfg /// Checks if all players are queued bool AllQueued(Lfg5Guids const& check); /// 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 static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2); /// Sends queue status to player