diff options
author | Spp <spp@jorge.gr> | 2012-10-04 12:58:52 +0200 |
---|---|---|
committer | Spp <spp@jorge.gr> | 2012-10-04 12:58:52 +0200 |
commit | e1bee86ee6f5c3ab7b1da6d1b54c98c2851f11ec (patch) | |
tree | c6e3af4fa8b5c692ac66966b11b5ba529414443a /src | |
parent | 2c961814c1e65feb7e82be193adcea0a0081f00c (diff) |
Core/Battlegrounds: Remove no longer needed files BattlegroundAA/BattlegroundRB
Diffstat (limited to 'src')
7 files changed, 57 insertions, 320 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index ffceab7fa2f..a787f4b6810 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -35,8 +35,6 @@ #include "BattlegroundDS.h" #include "BattlegroundRV.h" #include "BattlegroundIC.h" -#include "BattlegroundRB.h" -#include "BattlegroundAA.h" #include "Chat.h" #include "Map.h" #include "MapInstanced.h" @@ -572,10 +570,8 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original bg = new BattlegroundIC(*(BattlegroundIC*)bg_template); break; case BATTLEGROUND_RB: - bg = new BattlegroundRB(*(BattlegroundRB*)bg_template); - break; case BATTLEGROUND_AA: - bg = new BattlegroundAA(*(BattlegroundAA*)bg_template); + bg = new Battleground(*bg_template); break; default: return NULL; @@ -587,7 +583,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original bg->Reset(); // reset the new bg (set status to status_wait_queue from status_none) bg->SetStatus(STATUS_WAIT_JOIN); // start the joining of the bg bg->SetArenaType(arenaType); - bg->SetTypeID(isRandom ? BATTLEGROUND_RB : bgTypeId); + bg->SetTypeID(originalBgTypeId); bg->SetRandomTypeID(bgTypeId); bg->SetRated(isRated); bg->SetRandom(isRandom); @@ -635,11 +631,12 @@ bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) case BATTLEGROUND_IC: bg = new BattlegroundIC; break; - case BATTLEGROUND_RB: - bg = new BattlegroundRB; - break; case BATTLEGROUND_AA: - bg = new BattlegroundAA; + bg = new Battleground; + break; + case BATTLEGROUND_RB: + bg = new Battleground; + bg->SetRandom(true); break; default: return false; diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index f82d1f4e10a..aa4177eaf51 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -167,31 +167,31 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr } //add players from group to ginfo + if (grp) { - //ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock); - if (grp) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* member = itr->getSource(); - if (!member) - continue; // this should never happen - PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()]; - pl_info.LastOnlineTime = lastOnlineTime; - pl_info.GroupInfo = ginfo; - // add the pinfo to ginfo's list - ginfo->Players[member->GetGUID()] = &pl_info; - } - } - else - { - PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()]; + Player* member = itr->getSource(); + if (!member) + continue; // this should never happen + PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()]; pl_info.LastOnlineTime = lastOnlineTime; pl_info.GroupInfo = ginfo; - ginfo->Players[leader->GetGUID()] = &pl_info; + // add the pinfo to ginfo's list + ginfo->Players[member->GetGUID()] = &pl_info; } + } + else + { + PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()]; + pl_info.LastOnlineTime = lastOnlineTime; + pl_info.GroupInfo = ginfo; + ginfo->Players[leader->GetGUID()] = &pl_info; + } - //add GroupInfo to m_QueuedGroups + //add GroupInfo to m_QueuedGroups + { + //ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock); m_QueuedGroups[bracketId][index].push_back(ginfo); //announce to world, this code needs mutex @@ -299,11 +299,11 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) } GroupQueueInfo* group = itr->second.GroupInfo; - GroupsQueueType::iterator group_itr, group_itr_tmp; + GroupsQueueType::iterator group_itr; // mostly people with the highest levels are in battlegrounds, thats why // we count from MAX_BATTLEGROUND_QUEUES - 1 to 0 - // variable index removes useless searching in other team's queue - uint32 index = (group->Team == HORDE) ? TEAM_HORDE : TEAM_ALLIANCE; + + uint32 index = (group->Team == HORDE) ? BG_QUEUE_PREMADE_HORDE : BG_QUEUE_PREMADE_ALLIANCE; for (int32 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp) { @@ -311,12 +311,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) //they leave groupinfo so we can't use its players size to find out index for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT) { - for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp) + GroupsQueueType::iterator k = m_QueuedGroups[bracket_id_tmp][j].begin(); + for (; k != m_QueuedGroups[bracket_id_tmp][j].end(); ++k) { - if ((*group_itr_tmp) == group) + if ((*k) == group) { bracket_id = bracket_id_tmp; - group_itr = group_itr_tmp; + group_itr = k; //we must store index to be able to erase iterator index = j; break; @@ -345,7 +346,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) // if invited to bg, and should decrease invited count, then do it if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID) - if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : group->BgTypeId)) + if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId)) bg->DecreaseInvitedCount(group->Team); // remove player queue info @@ -375,11 +376,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { m_QueuedGroups[bracket_id][index].erase(group_itr); delete group; + return; } + // if group wasn't empty, so it wasn't deleted, and player have left a rated // queue -> everyone from the group should leave too // don't remove recursively if already invited to bg! - else if (!group->IsInvitedToBGInstanceGUID && group->IsRated) + if (!group->IsInvitedToBGInstanceGUID && group->IsRated) { // remove next player, this is recursive // first send removal information @@ -417,6 +420,11 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginf return true; } +uint32 BattlegroundQueue::GetPlayersInQueue(TeamId id) +{ + return m_SelectionPools[id].GetPlayerCount(); +} + bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side) { // set side if needed @@ -467,7 +475,8 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", + player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID()); // send status packet sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType); @@ -760,6 +769,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp // now everything is set, invite players for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.end(); ++citr) InviteGroupToBG((*citr), bg, (*citr)->Team); + for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_HORDE].SelectedGroups.end(); ++citr) InviteGroupToBG((*citr), bg, (*citr)->Team); @@ -787,58 +797,34 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp // get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!) uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam(); uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam(); - if (sBattlegroundMgr->isTesting()) - MinPlayersPerTeam = 1; + if (bg_template->isArena()) { - if (sBattlegroundMgr->isArenaTesting()) - { - MaxPlayersPerTeam = 1; - MinPlayersPerTeam = 1; - } - else - { - //this switch can be much shorter - MaxPlayersPerTeam = arenaType; - MinPlayersPerTeam = arenaType; - /*switch (arenaType) - { - case ARENA_TYPE_2v2: - MaxPlayersPerTeam = 2; - MinPlayersPerTeam = 2; - break; - case ARENA_TYPE_3v3: - MaxPlayersPerTeam = 3; - MinPlayersPerTeam = 3; - break; - case ARENA_TYPE_5v5: - MaxPlayersPerTeam = 5; - MinPlayersPerTeam = 5; - break; - }*/ - } + MaxPlayersPerTeam = arenaType; + MinPlayersPerTeam = sBattlegroundMgr->isArenaTesting() ? 1 : arenaType; } + else if (sBattlegroundMgr->isTesting()) + MinPlayersPerTeam = 1; m_SelectionPools[TEAM_ALLIANCE].Init(); m_SelectionPools[TEAM_HORDE].Init(); if (bg_template->isBattleground()) { - //check if there is premade against premade match if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)) { - //create new battleground + // create new battleground Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false); if (!bg2) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } - //invite those selection pools + // invite those selection pools for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) InviteGroupToBG((*citr), bg2, (*citr)->Team); - //start bg + bg2->StartBattleground(); //clear structures m_SelectionPools[TEAM_ALLIANCE].Init(); diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index 3610984213e..6f8c774864d 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -89,7 +89,7 @@ class BattlegroundQueue QueuedPlayersMap m_QueuedPlayers; //we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well - typedef std::list<GroupQueueInfo*> GroupsQueueType; + typedef std::deque<GroupQueueInfo*> GroupsQueueType; /* This two dimensional array is used to store All queued groups @@ -119,7 +119,7 @@ class BattlegroundQueue //one selection pool for horde, other one for alliance SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; - + uint32 GetPlayersInQueue(TeamId id); private: bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side); @@ -140,9 +140,8 @@ class BGQueueInviteEvent : public BasicEvent public: BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime) - { - }; - virtual ~BGQueueInviteEvent() {}; + { } + virtual ~BGQueueInviteEvent() { } virtual bool Execute(uint64 e_time, uint32 p_time); virtual void Abort(uint64 e_time); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp deleted file mode 100755 index e4c1b484d4d..00000000000 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "Battleground.h" -#include "BattlegroundAA.h" -#include "Language.h" -#include "Player.h" - -BattlegroundAA::BattlegroundAA() -{ - StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - //we must set messageIds - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; -} - -BattlegroundAA::~BattlegroundAA() -{ - -} - -void BattlegroundAA::StartingEventCloseDoors() -{ -} - -void BattlegroundAA::StartingEventOpenDoors() -{ -} - -void BattlegroundAA::AddPlayer(Player* player) -{ - Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundAAScore* sc = new BattlegroundAAScore; - - PlayerScores[player->GetGUID()] = sc; -} - -void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) -{ -} - -void BattlegroundAA::HandleKillPlayer(Player* player, Player* killer) -{ - Battleground::HandleKillPlayer(player, killer); -} - -void BattlegroundAA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) -{ -} - -bool BattlegroundAA::SetupBattleground() -{ - return true; -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h deleted file mode 100755 index f17de911ae9..00000000000 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef __BATTLEGROUNDAA_H -#define __BATTLEGROUNDAA_H - -class Battleground; - -class BattlegroundAAScore : public BattlegroundScore -{ - public: - BattlegroundAAScore() {}; - ~BattlegroundAAScore() {}; - //TODO fix me -}; - -class BattlegroundAA : public Battleground -{ - public: - BattlegroundAA(); - ~BattlegroundAA(); - - /* inherited from BattlegroundClass */ - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); - - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* Source, uint32 Trigger); - bool SetupBattleground(); - void HandleKillPlayer(Player* player, Player* killer); -}; -#endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp deleted file mode 100755 index 98985b41b5a..00000000000 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "Player.h" -#include "Battleground.h" -#include "BattlegroundRB.h" -#include "Language.h" - -BattlegroundRB::BattlegroundRB() -{ - //TODO FIX ME! - StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; -} - -BattlegroundRB::~BattlegroundRB() -{ - -} - -void BattlegroundRB::StartingEventCloseDoors() -{ -} - -void BattlegroundRB::StartingEventOpenDoors() -{ -} - -void BattlegroundRB::AddPlayer(Player* player) -{ - Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundRBScore* sc = new BattlegroundRBScore; - - PlayerScores[player->GetGUID()] = sc; -} - -void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) -{ -} - -void BattlegroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) -{ - // this is wrong way to implement these things. On official it done by gameobject spell cast. - if (GetStatus() != STATUS_IN_PROGRESS) - return; -} - -void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) -{ - std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID()); - - if (itr == PlayerScores.end()) // player not found... - return; - - Battleground::UpdatePlayerScore(Source, type, value, doAddHonor); -} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h deleted file mode 100755 index 1ad7dba1a8e..00000000000 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __BATTLEGROUNDRB_H -#define __BATTLEGROUNDRB_H - -class Battleground; - -class BattlegroundRBScore : public BattlegroundScore -{ - public: - BattlegroundRBScore() {}; - ~BattlegroundRBScore() {}; -}; - -class BattlegroundRB : public Battleground -{ - public: - BattlegroundRB(); - ~BattlegroundRB(); - - void AddPlayer(Player* player); - void StartingEventCloseDoors(); - void StartingEventOpenDoors(); - - void RemovePlayer(Player* player, uint64 guid, uint32 team); - void HandleAreaTrigger(Player* Source, uint32 Trigger); - - /* Scorekeeping */ - void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); - - private: -}; -#endif |