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

@@ -12,6 +12,7 @@
#include "MapManager.h"
#include "MapRefManager.h"
#include "ObjectMgr.h"
#include "GameTime.h"
#include "Pet.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
@@ -43,7 +44,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
sa.ownerGUID = ownerGUID;
sa.script = &iter->second;
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + iter->first), sa));
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime() + iter->first), sa));
if (iter->first == 0)
immedScript = true;
@@ -73,7 +74,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
sa.ownerGUID = ownerGUID;
sa.script = &script;
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + delay), sa));
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime() + delay), sa));
sScriptMgr->IncreaseScheduledScriptsCount();
@@ -280,7 +281,7 @@ void Map::ScriptsProcess()
///- Process overdue queued scripts
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
// ok as multimap is a *sorted* associative container
while (!m_scriptSchedule.empty() && (iter->first <= sWorld->GetGameTime()))
while (!m_scriptSchedule.empty() && (iter->first <= GameTime::GetGameTime()))
{
ScriptAction const& step = iter->second;