mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Misc: move scheduled scripts counter to ScriptMgr (which is more logical, isn't it?)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "MapRefManager.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
/// Put scripts in the execution queue
|
||||
void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target)
|
||||
@@ -53,11 +54,11 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
|
||||
sa.ownerGUID = ownerGUID;
|
||||
|
||||
sa.script = &iter->second;
|
||||
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(time_t(sWorld->GetGameTime() + iter->first), sa));
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + iter->first), sa));
|
||||
if (iter->first == 0)
|
||||
immedScript = true;
|
||||
|
||||
sWorld->IncreaseScheduledScriptsCount();
|
||||
sScriptMgr->IncreaseScheduledScriptsCount();
|
||||
}
|
||||
///- If one of the effects should be immediate, launch the script execution
|
||||
if (/*start &&*/ immedScript && !i_scriptLock)
|
||||
@@ -83,9 +84,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
||||
sa.ownerGUID = ownerGUID;
|
||||
|
||||
sa.script = &script;
|
||||
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(time_t(sWorld->GetGameTime() + delay), sa));
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + delay), sa));
|
||||
|
||||
sWorld->IncreaseScheduledScriptsCount();
|
||||
sScriptMgr->IncreaseScheduledScriptsCount();
|
||||
|
||||
///- If effects should be immediate, launch the script execution
|
||||
if (delay == 0 && !i_scriptLock)
|
||||
@@ -289,7 +290,7 @@ void Map::ScriptsProcess()
|
||||
return;
|
||||
|
||||
///- Process overdue queued scripts
|
||||
std::multimap<time_t, ScriptAction>::iterator iter = m_scriptSchedule.begin();
|
||||
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
|
||||
// ok as multimap is a *sorted* associative container
|
||||
while (!m_scriptSchedule.empty() && (iter->first <= sWorld->GetGameTime()))
|
||||
{
|
||||
@@ -923,8 +924,7 @@ void Map::ScriptsProcess()
|
||||
}
|
||||
|
||||
m_scriptSchedule.erase(iter);
|
||||
sWorld->DecreaseScheduledScriptCount();
|
||||
|
||||
iter = m_scriptSchedule.begin();
|
||||
sScriptMgr->DecreaseScheduledScriptCount();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user