Revert "Core/Battlegrounds: Remove player on leave from battleground player map only after battleground-specific code"

Some battlegrounds (arenas) need access to the updated player map in RemovePlayer(), pass team as parameter instead
This commit is contained in:
Shocker
2011-06-18 14:08:51 +03:00
parent 06690cb4b8
commit 7f0af21fcd
28 changed files with 39 additions and 40 deletions

View File

@@ -873,6 +873,16 @@ void Battleground::BlockMovement(Player* plr)
void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool SendPacket)
{
uint32 team = GetPlayerTeam(guid);
bool participant = false;
// Remove from lists/maps
BattlegroundPlayerMap::iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
{
UpdatePlayersCountByTeam(team, true); // -1 player
m_Players.erase(itr);
// check if the player was a participant of the match, or only entered through gm command (goname)
participant = true;
}
BattlegroundScoreMap::iterator itr2 = m_PlayerScores.find(guid);
if (itr2 != m_PlayerScores.end())
@@ -895,18 +905,7 @@ void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool
plr->SpawnCorpseBones();
}
RemovePlayer(plr, guid); // BG subclass specific code
bool participant = false;
// Remove from lists/maps
BattlegroundPlayerMap::iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
{
UpdatePlayersCountByTeam(team, true); // -1 player
m_Players.erase(itr);
// check if the player was a participant of the match, or only entered through gm command (goname)
participant = true;
}
RemovePlayer(plr, guid, team); // BG subclass specific code
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
{
@@ -1191,7 +1190,7 @@ void Battleground::EventPlayerLoggedOut(Player* player)
if (GetStatus() == STATUS_IN_PROGRESS)
{
// drop flag and handle other cleanups
RemovePlayer(player, player->GetGUID());
RemovePlayer(player, player->GetGUID(), GetPlayerTeam(player->GetGUID()));
// 1 player is logging out, if it is the last, then end arena!
if (isArena())

View File

@@ -591,7 +591,7 @@ class Battleground
// Scorekeeping
BattlegroundScoreMap m_PlayerScores; // Player scores
// must be implemented in BG subclass
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/) {}
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) {}
// Player lists, those need to be accessible by inherited classes
BattlegroundPlayerMap m_Players;

View File

@@ -62,7 +62,7 @@ void BattlegroundAA::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
}

View File

@@ -42,7 +42,7 @@ class BattlegroundAA : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);

View File

@@ -215,7 +215,7 @@ void BattlegroundAB::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
}

View File

@@ -251,7 +251,7 @@ class BattlegroundAB : public Battleground
void AddPlayer(Player *plr);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
virtual bool SetupBattleground();
virtual void Reset();

View File

@@ -475,7 +475,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
Battleground::EndBattleground(winner);
}
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/)
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
{
if (!plr)
{

View File

@@ -1546,7 +1546,7 @@ class BattlegroundAV : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
virtual void ResetBGSubclass();

View File

@@ -87,7 +87,7 @@ void BattlegroundBE::AddPlayer(Player *plr)
UpdateArenaWorldState();
}
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;

View File

@@ -62,7 +62,7 @@ class BattlegroundBE : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();

View File

@@ -110,7 +110,7 @@ void BattlegroundDS::AddPlayer(Player *plr)
UpdateArenaWorldState();
}
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;

View File

@@ -71,7 +71,7 @@ class BattlegroundDS : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();

View File

@@ -343,7 +343,7 @@ void BattlegroundEY::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid)
void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)

View File

@@ -348,7 +348,7 @@ class BattlegroundEY : public Battleground
void RespawnFlag(bool send_message);
void RespawnFlagAfterDrop();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleBuffUse(uint64 const& buff_guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);

View File

@@ -310,7 +310,7 @@ void BattlegroundIC::AddPlayer(Player *plr)
SendTransportInit(plr);
}
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/)
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
{
plr->RemoveAura(SPELL_QUARRY);
plr->RemoveAura(SPELL_OIL_REFINERY);

View File

@@ -869,7 +869,7 @@ class BattlegroundIC : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
void SpawnLeader(uint32 teamid);

View File

@@ -84,7 +84,7 @@ void BattlegroundNA::AddPlayer(Player *plr)
UpdateArenaWorldState();
}
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;

View File

@@ -63,7 +63,7 @@ class BattlegroundNA : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();

View File

@@ -57,7 +57,7 @@ void BattlegroundRB::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
}

View File

@@ -41,7 +41,7 @@ class BattlegroundRB : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
/* Scorekeeping */

View File

@@ -84,7 +84,7 @@ void BattlegroundRL::AddPlayer(Player *plr)
UpdateArenaWorldState();
}
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;

View File

@@ -61,7 +61,7 @@ class BattlegroundRL : public Battleground
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);

View File

@@ -131,7 +131,7 @@ void BattlegroundRV::AddPlayer(Player *plr)
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
}
void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;

View File

@@ -118,7 +118,7 @@ class BattlegroundRV : public Battleground
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);

View File

@@ -465,7 +465,7 @@ void BattlegroundSA::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
{
}

View File

@@ -481,7 +481,7 @@ class BattlegroundSA : public Battleground
void EndBattleground(uint32 winner);
/// CAlled when a player leave battleground
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
/* Scorekeeping */

View File

@@ -559,7 +559,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid)
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)

View File

@@ -190,7 +190,7 @@ class BattlegroundWS : public Battleground
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
virtual void EventPlayerCapturedFlag(Player *Source);
void RemovePlayer(Player *plr, uint64 guid);
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
bool SetupBattleground();