diff options
author | pjasicek <pjasicek@gmail.com> | 2015-05-25 20:53:59 +0200 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2015-06-03 02:44:36 +0200 |
commit | 6a637f6b1c186eb15373fce443d729dcc74e5361 (patch) | |
tree | 5332eb12f39c92b283ff499c3faf2e951a3f1fae /src | |
parent | 3d8ae16c0049dbb1eac478d978537e076c3cad3f (diff) |
Core/Matchmaking: Fix Discard Time overflow on server start
Description:
When server starts and RatingDiscardTimer config is set to some value, discardTime being unsigned int overflows for the time of RatingDiscardTimer value and causing all rated arena matches ignore matchmaking rating for that time.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Battlegrounds/BattlegroundQueue.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index d9db2a9b5d1..43b7acde925 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -889,7 +889,8 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp // (after what time the ratings aren't taken into account when making teams) then // the discard time is current_time - time_to_discard, teams that joined after that, will have their ratings taken into account // else leave the discard time on 0, this way all ratings will be discarded - uint32 discardTime = getMSTime() - sBattlegroundMgr->GetRatingDiscardTimer(); + // this has to be signed value - when the server starts, this value would be negative and thus overflow + int32 discardTime = getMSTime() - sBattlegroundMgr->GetRatingDiscardTimer(); // we need to find 2 teams which will play next game GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT]; @@ -905,7 +906,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp // if group match conditions, then add it to pool if (!(*itr2)->IsInvitedToBGInstanceGUID && (((*itr2)->ArenaMatchmakerRating >= arenaMinRating && (*itr2)->ArenaMatchmakerRating <= arenaMaxRating) - || (*itr2)->JoinTime < discardTime)) + || (int32)(*itr2)->JoinTime < discardTime)) { itr_teams[found++] = itr2; team = i; @@ -923,7 +924,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp { if (!(*itr3)->IsInvitedToBGInstanceGUID && (((*itr3)->ArenaMatchmakerRating >= arenaMinRating && (*itr3)->ArenaMatchmakerRating <= arenaMaxRating) - || (*itr3)->JoinTime < discardTime) + || (int32)(*itr3)->JoinTime < discardTime) && (*itr_teams[0])->ArenaTeamId != (*itr3)->ArenaTeamId) { itr_teams[found++] = itr3; |