diff options
| -rw-r--r-- | src/game/World.cpp | 13 | ||||
| -rw-r--r-- | src/game/World.h | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp index 5c40acd9c40..f7e10c62dc9 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1631,7 +1631,7 @@ void World::ForceGameEventUpdate() } /// Put scripts in the execution queue -void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target) +void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target, bool start) { ///- Find the script map ScriptMapMap::const_iterator s = scripts.find(id); @@ -1659,7 +1659,7 @@ void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, immedScript = true; } ///- If one of the effects should be immediate, launch the script execution - if (immedScript) + if (start && immedScript) ScriptsProcess(); } @@ -2367,12 +2367,9 @@ void World::ScriptsProcess() break; uint32 script_id = step.script->datalong2; - //delete iter and return it to begin pos(next one) - m_scriptSchedule.erase(iter); - iter = m_scriptSchedule.begin(); - - ScriptsStart(*datamap, script_id, target, NULL); - return; + //insert script into schedule but do not start it + ScriptsStart(*datamap, script_id, target, NULL, false); + break; } case SCRIPT_COMMAND_PLAYSOUND: diff --git a/src/game/World.h b/src/game/World.h index 03b0b0e0c88..ff03f4124b0 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -488,7 +488,7 @@ class World BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); bool RemoveBanAccount(BanMode mode, std::string nameOrIP); - void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); + void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target, bool start = true); void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target); bool IsScriptScheduled() const { return !m_scriptSchedule.empty(); } |
