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
This commit is contained in:
xinef1
2017-03-02 02:19:25 +01:00
committed by ariel-
parent 7011aabb56
commit 7567cafec8
44 changed files with 495 additions and 196 deletions

View File

@@ -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;