feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -22,6 +22,7 @@
#include "GuildMgr.h"
#include "Group.h"
#include "Guild.h"
#include "GameTime.h"
#include "World.h"
#include "ObjectAccessor.h"
#include "BattlegroundMgr.h"
@@ -197,13 +198,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = time(NULL);
static time_t firstTime = GameTime::GetGameTime();
static time_t lastTime = firstTime; // next 60 secs start time
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = time(NULL);
time_t cur_time = GameTime::GetGameTime();
if ((cur_time - lastTime) < 60)
{
@@ -389,7 +390,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
time_t currTime = GameTime::GetGameTime();
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
@@ -426,7 +427,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions)
// pussywizard: handle teleport ack timeout
if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported())
{
time_t currTime = time(NULL);
time_t currTime = GameTime::GetGameTime();
if (updateInSessions) // session update from World::UpdateSessions
{
if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime)
@@ -769,7 +770,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
void WorldSession::SendAccountDataTimes(uint32 mask)
{
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK
data << uint32(time(NULL)); // unix time of something
data << uint32(GameTime::GetGameTime()); // unix time of something
data << uint8(1);
data << uint32(mask); // type mask
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)