*Fix a crash caused by scriptprocess

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-04 20:31:43 -06:00
parent 9a03bb1e5f
commit f692364e8e
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -1631,7 +1631,7 @@ void World::ForceGameEventUpdate()
} }
/// Put scripts in the execution queue /// 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 ///- Find the script map
ScriptMapMap::const_iterator s = scripts.find(id); ScriptMapMap::const_iterator s = scripts.find(id);
@@ -1659,7 +1659,7 @@ void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source,
immedScript = true; immedScript = true;
} }
///- If one of the effects should be immediate, launch the script execution ///- If one of the effects should be immediate, launch the script execution
if (immedScript) if (start && immedScript)
ScriptsProcess(); ScriptsProcess();
} }
@@ -2367,12 +2367,9 @@ void World::ScriptsProcess()
break; break;
uint32 script_id = step.script->datalong2; uint32 script_id = step.script->datalong2;
//delete iter and return it to begin pos(next one) //insert script into schedule but do not start it
m_scriptSchedule.erase(iter); ScriptsStart(*datamap, script_id, target, NULL, false);
iter = m_scriptSchedule.begin(); break;
ScriptsStart(*datamap, script_id, target, NULL);
return;
} }
case SCRIPT_COMMAND_PLAYSOUND: case SCRIPT_COMMAND_PLAYSOUND:
+1 -1
View File
@@ -488,7 +488,7 @@ class World
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 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); void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target);
bool IsScriptScheduled() const { return !m_scriptSchedule.empty(); } bool IsScriptScheduled() const { return !m_scriptSchedule.empty(); }