make sure spell caster does not persist if they are removed from the spawn list
This commit is contained in:
parent
4f3f5a5920
commit
52ed0cf1d3
@ -43,7 +43,9 @@ SpellProcess::~SpellProcess(){
|
|||||||
RemoveAllSpells();
|
RemoveAllSpells();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellProcess::RemoveCaster(Spawn* caster){
|
void SpellProcess::RemoveCaster(Spawn* caster, bool lock_spell_process){
|
||||||
|
if(lock_spell_process)
|
||||||
|
MSpellProcess.lock_shared();
|
||||||
MutexList<LuaSpell*>::iterator active_spells_itr = active_spells.begin();
|
MutexList<LuaSpell*>::iterator active_spells_itr = active_spells.begin();
|
||||||
while(active_spells_itr.Next()){
|
while(active_spells_itr.Next()){
|
||||||
LuaSpell* spell = active_spells_itr->value;
|
LuaSpell* spell = active_spells_itr->value;
|
||||||
@ -55,6 +57,8 @@ void SpellProcess::RemoveCaster(Spawn* caster){
|
|||||||
spell->initial_target = 0;
|
spell->initial_target = 0;
|
||||||
spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
|
spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
if(lock_spell_process)
|
||||||
|
MSpellProcess.unlock_shared();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellProcess::RemoveAllSpells(bool reload_spells){
|
void SpellProcess::RemoveAllSpells(bool reload_spells){
|
||||||
|
@ -158,7 +158,7 @@ public:
|
|||||||
~SpellProcess();
|
~SpellProcess();
|
||||||
|
|
||||||
/// Remove dead pointers for casters when the Spawn is deconstructed
|
/// Remove dead pointers for casters when the Spawn is deconstructed
|
||||||
void RemoveCaster(Spawn* caster);
|
void RemoveCaster(Spawn* caster, bool lock_spell_process = true);
|
||||||
|
|
||||||
/// <summary>Remove all spells from the SpellProcess </summary>
|
/// <summary>Remove all spells from the SpellProcess </summary>
|
||||||
void RemoveAllSpells(bool reload_spells = false);
|
void RemoveAllSpells(bool reload_spells = false);
|
||||||
|
@ -6720,7 +6720,11 @@ void ZoneServer::RemoveSpawnSupportFunctions(Spawn* spawn, bool lock_spell_proce
|
|||||||
}
|
}
|
||||||
if(spawn->IsEntity())
|
if(spawn->IsEntity())
|
||||||
RemoveSpellTimersFromSpawn((Entity*)spawn, true, true, true, lock_spell_process);
|
RemoveSpellTimersFromSpawn((Entity*)spawn, true, true, true, lock_spell_process);
|
||||||
|
|
||||||
|
if (spellProcess) {
|
||||||
|
spellProcess->RemoveCaster(spawn, lock_spell_process);
|
||||||
|
}
|
||||||
|
|
||||||
if(!shutdown) { // in case of shutdown, DeleteData(true) handles the cleanup later via DeleteSpawnScriptTimers
|
if(!shutdown) { // in case of shutdown, DeleteData(true) handles the cleanup later via DeleteSpawnScriptTimers
|
||||||
StopSpawnScriptTimer(spawn, "");
|
StopSpawnScriptTimer(spawn, "");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user