*[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
This commit is contained in:
maximius
2009-09-11 16:25:11 -07:00
parent 996fcc967f
commit 2bb0c31978
9 changed files with 48 additions and 43 deletions
+8 -11
View File
@@ -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++)
{