aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-10-07 22:15:01 +0200
committerjackpoz <giacomopoz@gmail.com>2014-10-07 22:15:01 +0200
commitdb88bf02b54fd3596a2bf90cfc3ad55cd42b158d (patch)
treeb5e604d956786e6f3f144079585bd6ec57048bef /src/server/game
parentdef151bb18b31e829ebe3761ff857990fca92a7e (diff)
Core/LFG: Fix Leader flag being ignored
Fix bug added in 5ca00bc14d38c5ad49f0ab4500af52e645133826 that removed Leader flag of LFG without ever adding it back, giving leadership to players who didn't want it.
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp28
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h2
2 files changed, 13 insertions, 17 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index c1f2fe33889..ac6de073543 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -770,10 +770,9 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& playe
Check if a group can be formed with the given group roles
@param[in] groles Map of roles to check
- @param[in] removeLeaderFlag Determines if we have to remove leader flag (only used first call, Default = true)
@return True if roles are compatible
*/
-bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/)
+bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles)
{
if (groles.empty())
return false;
@@ -782,21 +781,18 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
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 role = it->second & ~PLAYER_ROLE_LEADER;
+ if (role == PLAYER_ROLE_NONE)
return false;
- 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 (CheckGroupRoles(groles, false))
+ if (CheckGroupRoles(groles))
return true;
it->second += PLAYER_ROLE_DAMAGE;
}
@@ -806,12 +802,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
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 (CheckGroupRoles(groles, false))
+ if (CheckGroupRoles(groles))
return true;
it->second += PLAYER_ROLE_HEALER;
}
@@ -821,12 +817,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
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 (CheckGroupRoles(groles, false))
+ if (CheckGroupRoles(groles))
return true;
it->second += PLAYER_ROLE_TANK;
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index b75686945a5..e368791c134 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -411,7 +411,7 @@ class LFGMgr
/// Checks if all players are queued
bool AllQueued(GuidList const& check);
/// Checks if given roles match, modifies given roles map with new roles
- static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
+ static bool CheckGroupRoles(LfgRolesMap &groles);
/// Checks if given players are ignoring each other
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
/// Sends queue status to player