diff options
| author | maximius <none@none> | 2009-09-11 16:25:11 -0700 |
|---|---|---|
| committer | maximius <none@none> | 2009-09-11 16:25:11 -0700 |
| commit | 2bb0c319789c893255d94556bd8a819f96be0c0d (patch) | |
| tree | 8ac2b7dded072fce9ff871b4ffc7990b018143cb /src/game/BattleGroundMgr.cpp | |
| parent | 996fcc967f05e304cc0e51bb4e0dd2d5a0de17c9 (diff) | |
*[8474] Allow to delete BattleGround objects when any of invited players didn't click to enter battle. Rename m_TeamScores500disadvantage to m_TeamScores500Disadvantage, and optimize its update. Patch is tested. Author: Triply
*Added some missed changes that might of broken compile in the last 2~ commits.
*Some fixes to Warlock's Death Coil by Gyullo.
*Last MaNGOS merge until KingPin says otherwise..
--HG--
branch : trunk
Diffstat (limited to 'src/game/BattleGroundMgr.cpp')
| -rw-r--r-- | src/game/BattleGroundMgr.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 49424249eb3..a06b7f45f7b 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1184,13 +1184,16 @@ void BattleGroundMgr::Update(uint32 diff) if (!m_QueueUpdateScheduler.empty()) { //copy vector and clear the other + // TODO add lock + // TODO maybe std::list would be better and then unlock after end of cycle std::vector<uint32> scheduled(m_QueueUpdateScheduler); m_QueueUpdateScheduler.clear(); + // TODO drop lock for (uint8 i = 0; i < scheduled.size(); i++) { - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] / 65536); - BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] % 65536) / 256); - BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] % 256); + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16); + BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255); + BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] & 255); m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id); } } @@ -1616,12 +1619,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI bg->SetArenaType(arenaType); bg->SetRated(isRated); - // add BG to free slot queue - bg->AddToBGFreeSlotQueue(); - - // add bg to update list - AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); - return bg; } @@ -2036,9 +2033,9 @@ void BattleGroundMgr::SetHolidayWeekends(uint32 mask) void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) { - //This method must be atomic! + //This method must be atomic, TODO add mutex //we will use only 1 number created of bgTypeId and queue_id - uint32 schedule_id = (bgQueueTypeId * 65536) + (bgTypeId * 256) + queue_id; + uint32 schedule_id = (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id; bool found = false; for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++) { |
