File tree Expand file tree Collapse file tree
src/server/game/Battlefield Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,18 @@ Battlefield::~Battlefield()
7676
7777void Battlefield::HandlePlayerEnterZone (Player* player, uint32 /* zone*/ )
7878{
79+ // Clear any stale entries from a prior visit that did not unwind cleanly.
80+ // Runs before the script hook so scripts see a clean state if they read any
81+ // of these containers.
82+ for (uint8 i = 0 ; i < PVP_TEAMS_COUNT; ++i)
83+ {
84+ PlayersInWar[i].erase (player->GetGUID ());
85+ InvitedPlayers[i].erase (player->GetGUID ());
86+ PlayersInQueue[i].erase (player->GetGUID ());
87+ PlayersWillBeKick[i].erase (player->GetGUID ());
88+ Players[i].erase (player->GetGUID ());
89+ }
90+
7991 // Allow scripts to adjust the player's effective team or appearance before
8092 // any team-based battlefield containers (such as player lists or queues) are updated.
8193 sScriptMgr ->OnBattlefieldPlayerEnterZone (this , player);
You can’t perform that action at this time.
0 commit comments