*Fix a crash caused by scriptprocess
--HG-- branch : trunk
This commit is contained in:
+5
-8
@@ -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:
|
||||
|
||||
+1
-1
@@ -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(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user