From 60663d1374beef3103f4787152654034fa4a8897 Mon Sep 17 00:00:00 2001 From: xinef1 Date: Thu, 2 Mar 2017 02:19:25 +0100 Subject: 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) --- src/server/game/Maps/MapScripts.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/server/game/Maps/MapScripts.cpp') diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp index f6fed3dad9a..2e886a287c4 100644 --- a/src/server/game/Maps/MapScripts.cpp +++ b/src/server/game/Maps/MapScripts.cpp @@ -18,6 +18,7 @@ #include "Map.h" #include "CellImpl.h" +#include "GameTime.h" #include "GossipDef.h" #include "GridNotifiers.h" #include "Item.h" @@ -56,7 +57,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; @@ -86,7 +87,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)); sMapMgr->IncreaseScheduledScriptsCount(); @@ -300,7 +301,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; -- cgit v1.2.3