aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpjasicek <pjasicek@gmail.com>2015-05-25 20:53:59 +0200
committerDDuarte <dnpd.dd@gmail.com>2015-06-26 03:19:29 +0100
commitfc214b90ff3ade06f23b2ca3a3dcf6fc38e2948e (patch)
tree0e0ba0bd68d10d1c33b1dfcb585bdebc24d0679c
parent9382678b2b699ec0fa9efb932de8c6a7c0991dd7 (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. (cherry picked from commit 6a637f6b1c186eb15373fce443d729dcc74e5361)
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 06dd5ff6996..d888485887e 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -890,7 +890,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];
@@ -906,7 +907,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;
@@ -924,7 +925,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;