1
0

Fix accidentally not nullifying the spell pointer when we remove a spell effect

This commit is contained in:
Emagi 2025-01-21 07:37:22 -05:00
parent 78db10105e
commit bd9f1bd8ce
3 changed files with 4 additions and 5 deletions

View File

@ -1174,6 +1174,7 @@ void Entity::RemoveSpellEffect(LuaSpell* spell) {
GetZone()->GetSpellProcess()->RemoveTargetFromSpell(spell, this);
memset(&GetInfoStruct()->spell_effects[44], 0, sizeof(SpellEffects));
GetInfoStruct()->spell_effects[44].spell_id = 0xFFFFFFFF;
GetInfoStruct()->spell_effects[44].spell = nullptr;
changed = true;
info_changed = true;
AddChangedZoneSpawn();

View File

@ -1676,15 +1676,12 @@ void LuaInterface::DeletePendingSpells(bool all) {
if(spell->targets.size() > 0) {
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
for (int8 i = 0; i < spell->targets.size(); i++) {
Spawn* target = spell->caster->GetZone()->GetSpawnByID(spell->targets.at(i));
Spawn* target = spell->zone->GetSpawnByID(spell->targets.at(i));
if (!target || !target->IsEntity())
continue;
ZoneServer* targetZone = target->GetZone();
if(!targetZone)
continue;
if(!spellDeleted)
targetZone->GetSpellProcess()->DeleteActiveSpell(spell, true);
spell->zone->GetSpellProcess()->DeleteActiveSpell(spell, true);
spellDeleted = true;
}

View File

@ -3540,6 +3540,7 @@ void Player::RemoveSpellEffect(LuaSpell* spell){
if (found) {
memset(&GetInfoStruct()->spell_effects[44], 0, sizeof(SpellEffects));
GetInfoStruct()->spell_effects[44].spell_id = 0xFFFFFFFF;
GetInfoStruct()->spell_effects[44].spell = nullptr;
changed = true;
info_changed = true;
AddChangedZoneSpawn();