fix(Core/Battlefield): keep queued players in queue when leaving the zone (#26140)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-06-10 19:44:00 -03:00
committed by GitHub
parent 782af65001
commit 3319c3b140
2 changed files with 5 additions and 4 deletions

View File

@@ -74,12 +74,13 @@ Battlefield::~Battlefield()
CapturePoints.clear();
}
void Battlefield::RemovePlayerFromTracking(ObjectGuid playerGuid)
void Battlefield::RemovePlayerFromTracking(ObjectGuid playerGuid, bool removeFromQueue /*= true*/)
{
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
{
InvitedPlayers[i].erase(playerGuid);
PlayersInQueue[i].erase(playerGuid);
if (removeFromQueue)
PlayersInQueue[i].erase(playerGuid);
PlayersWillBeKick[i].erase(playerGuid);
Players[i].erase(playerGuid);
}
@@ -152,7 +153,7 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
for (BfCapturePoint* cp : CapturePoints)
cp->HandlePlayerLeave(player);
RemovePlayerFromTracking(player->GetGUID());
RemovePlayerFromTracking(player->GetGUID(), /*removeFromQueue=*/false);
SendRemoveWorldStates(player);
RemovePlayerFromResurrectQueue(player->GetGUID());
OnPlayerLeaveZone(player);

View File

@@ -444,7 +444,7 @@ protected:
/// Returns true if the player is already tracked as actively in the war or invited to join it.
bool IsPlayerInWarOrInvited(Player* player) const;
void RemovePlayerFromTracking(ObjectGuid playerGuid);
void RemovePlayerFromTracking(ObjectGuid playerGuid, bool removeFromQueue = true);
// Player-iteration helpers: resolve each GUID to a live Player* and call fn(player).
// Using templates avoids std::function overhead and works naturally with lambdas.