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/Maps/MapScripts.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/Maps/MapScripts.cpp')
-rw-r--r-- | src/server/game/Maps/MapScripts.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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; |