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:
@@ -74,12 +74,13 @@ Battlefield::~Battlefield()
|
|||||||
CapturePoints.clear();
|
CapturePoints.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::RemovePlayerFromTracking(ObjectGuid playerGuid)
|
void Battlefield::RemovePlayerFromTracking(ObjectGuid playerGuid, bool removeFromQueue /*= true*/)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||||
{
|
{
|
||||||
InvitedPlayers[i].erase(playerGuid);
|
InvitedPlayers[i].erase(playerGuid);
|
||||||
PlayersInQueue[i].erase(playerGuid);
|
if (removeFromQueue)
|
||||||
|
PlayersInQueue[i].erase(playerGuid);
|
||||||
PlayersWillBeKick[i].erase(playerGuid);
|
PlayersWillBeKick[i].erase(playerGuid);
|
||||||
Players[i].erase(playerGuid);
|
Players[i].erase(playerGuid);
|
||||||
}
|
}
|
||||||
@@ -152,7 +153,7 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
|||||||
for (BfCapturePoint* cp : CapturePoints)
|
for (BfCapturePoint* cp : CapturePoints)
|
||||||
cp->HandlePlayerLeave(player);
|
cp->HandlePlayerLeave(player);
|
||||||
|
|
||||||
RemovePlayerFromTracking(player->GetGUID());
|
RemovePlayerFromTracking(player->GetGUID(), /*removeFromQueue=*/false);
|
||||||
SendRemoveWorldStates(player);
|
SendRemoveWorldStates(player);
|
||||||
RemovePlayerFromResurrectQueue(player->GetGUID());
|
RemovePlayerFromResurrectQueue(player->GetGUID());
|
||||||
OnPlayerLeaveZone(player);
|
OnPlayerLeaveZone(player);
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ protected:
|
|||||||
/// Returns true if the player is already tracked as actively in the war or invited to join it.
|
/// Returns true if the player is already tracked as actively in the war or invited to join it.
|
||||||
bool IsPlayerInWarOrInvited(Player* player) const;
|
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).
|
// 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.
|
// Using templates avoids std::function overhead and works naturally with lambdas.
|
||||||
|
|||||||
Reference in New Issue
Block a user