diff options
author | xinef1 <w.szyszko2@gmail.com> | 2017-03-02 02:19:25 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-08-17 20:04:14 +0200 |
commit | 60663d1374beef3103f4787152654034fa4a8897 (patch) | |
tree | 38e07d44442ad903a9729536942e8e253a072274 /src/server/game/Battlegrounds/BattlegroundQueue.cpp | |
parent | 98180ecdc179386270e93b80c0db8344b659557f (diff) |
Ensure that all actions are compared to fixed point in time (ie. world update start) (#18910)
- Actions will not be dependent on processing moment
- Increased GameObjects cooldown resolution to milliseconds, fixes arming time of traps to be exactly one second and not something from range (1000, 1999)
- Created GameTime namespace and UpdateTime class and moved there some code out of world
(cherrypicked from 7567cafec84080d26ea513242a1f540a823b8f9d)
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundQueue.cpp')
-rw-r--r-- | src/server/game/Battlegrounds/BattlegroundQueue.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index e0232ac3760..57ff626f1b4 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -23,6 +23,7 @@ #include "BattlegroundPackets.h" #include "Chat.h" #include "DB2Stores.h" +#include "GameTime.h" #include "Group.h" #include "Language.h" #include "Log.h" @@ -141,7 +142,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr ginfo->ArenaTeamId = arenateamid; ginfo->IsRated = isRated; ginfo->IsInvitedToBGInstanceGUID = 0; - ginfo->JoinTime = getMSTime(); + ginfo->JoinTime = GameTime::GetGameTimeMS(); ginfo->RemoveInviteTime = 0; ginfo->Team = leader->GetTeam(); ginfo->ArenaTeamRating = ArenaRating; @@ -159,7 +160,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr index++; TC_LOG_DEBUG("bg.battleground", "Adding Group to BattlegroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index); - uint32 lastOnlineTime = getMSTime(); + uint32 lastOnlineTime = GameTime::GetGameTimeMS(); //announce world (this don't need mutex) if (isRated && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) @@ -236,7 +237,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) { - uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime()); + uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, GameTime::GetGameTimeMS()); uint8 team_index = TEAM_ALLIANCE; //default set to TEAM_ALLIANCE - or non rated arenas! if (!ginfo->ArenaType) { @@ -448,7 +449,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, if (bg->isArena() && bg->isRated()) bg->SetArenaTeamIdForTeam(ginfo->Team, ginfo->ArenaTeamId); - ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME; + ginfo->RemoveInviteTime = GameTime::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME; // loop through the players for (std::map<ObjectGuid, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) @@ -639,7 +640,7 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint // this could be 2 cycles but i'm checking only first team in queue - it can cause problem - // if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg // and when they click or after 80 seconds the queue info is removed from queue - uint32 time_before = getMSTime() - sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH); + uint32 time_before = GameTime::GetGameTimeMS() - sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH); for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) { if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty()) @@ -920,7 +921,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp // 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 // this has to be signed value - when the server starts, this value would be negative and thus overflow - int32 discardTime = getMSTime() - sBattlegroundMgr->GetRatingDiscardTimer(); + int32 discardTime = GameTime::GetGameTimeMS() - sBattlegroundMgr->GetRatingDiscardTimer(); // we need to find 2 teams which will play next game GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT]; |