Fix AE Ramp iterator issue

This commit is contained in:
Michael Cook (mackal) 2015-07-31 02:00:09 -04:00
parent b98bc207fb
commit 7fc8841a67
2 changed files with 2 additions and 2 deletions

View File

@ -539,13 +539,13 @@ int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOption
auto it = list.begin();
while (it != list.end() && (count == -1 || hit_count < count)) {
struct_HateList *h = (*it);
++it; // advancing the iterator here prevents the iterator being invalidated if they die
if (h && h->entity_on_hatelist && h->entity_on_hatelist != caster) {
if (caster->CombatRange(h->entity_on_hatelist)) {
++hit_count;
caster->ProcessAttackRounds(h->entity_on_hatelist, opts);
}
}
++it;
}
return hit_count;

View File

@ -2000,7 +2000,7 @@ void Mob::AreaRampage(ExtraAttackOptions *opts)
}
int rampage_targets = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 1);
rampage_targets = rampage_targets > 0 ? rampage_targets : 1;
rampage_targets = rampage_targets > 0 ? rampage_targets : -1;
index_hit = hate_list.AreaRampage(this, GetTarget(), rampage_targets, opts);
if(index_hit == 0)