aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/MapScripts.cpp
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2017-03-02 02:19:25 +0100
committerariel- <ariel-@users.noreply.github.com>2017-03-01 22:19:25 -0300
commit7567cafec84080d26ea513242a1f540a823b8f9d (patch)
treef6f37a7cc4d06db0dbb0e08a01f8a18cf47ac955 /src/server/game/Maps/MapScripts.cpp
parent7011aabb56f061fc889ec42ce32b7605ceb35b53 (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
Diffstat (limited to 'src/server/game/Maps/MapScripts.cpp')
-rw-r--r--src/server/game/Maps/MapScripts.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp
index 2b606f32875..f5c8cd971b9 100644
--- a/src/server/game/Maps/MapScripts.cpp
+++ b/src/server/game/Maps/MapScripts.cpp
@@ -17,6 +17,7 @@
*/
#include "CellImpl.h"
+#include "GameTime.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GossipDef.h"
@@ -55,7 +56,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;
@@ -85,7 +86,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();
@@ -285,7 +286,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;