mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
fix(Core/Battlefield): pre-clear stale tracking on enter (#25989)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,18 @@ Battlefield::~Battlefield()
|
|||||||
|
|
||||||
void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||||
{
|
{
|
||||||
|
// Clear any stale entries from a prior visit that did not unwind cleanly.
|
||||||
|
// Runs before the script hook so scripts see a clean state if they read any
|
||||||
|
// of these containers.
|
||||||
|
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||||
|
{
|
||||||
|
PlayersInWar[i].erase(player->GetGUID());
|
||||||
|
InvitedPlayers[i].erase(player->GetGUID());
|
||||||
|
PlayersInQueue[i].erase(player->GetGUID());
|
||||||
|
PlayersWillBeKick[i].erase(player->GetGUID());
|
||||||
|
Players[i].erase(player->GetGUID());
|
||||||
|
}
|
||||||
|
|
||||||
// Allow scripts to adjust the player's effective team or appearance before
|
// Allow scripts to adjust the player's effective team or appearance before
|
||||||
// any team-based battlefield containers (such as player lists or queues) are updated.
|
// any team-based battlefield containers (such as player lists or queues) are updated.
|
||||||
sScriptMgr->OnBattlefieldPlayerEnterZone(this, player);
|
sScriptMgr->OnBattlefieldPlayerEnterZone(this, player);
|
||||||
|
|||||||
Reference in New Issue
Block a user