Fix infinite loops

This commit is contained in:
Michael Cook (mackal) 2016-10-24 13:29:07 -04:00
parent aabf7b9b5a
commit a6f5571750

View File

@ -5653,14 +5653,18 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
auto fac = (*iter)->GetReverseFactionCon(this);
if (beneficial_targets) {
// only affect mobs we would assist.
if (!(fac <= FACTION_AMIABLE))
if (!(fac <= FACTION_AMIABLE)) {
++iter;
continue;
}
} else {
// affect mobs that are on our hate list, or which have bad faction with us
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS))
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) {
++iter;
continue;
}
}
}
//# shortest distance from line to target point
float d = std::abs((*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1);
@ -5721,14 +5725,18 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust)
auto fac = (*iter)->GetReverseFactionCon(this);
if (beneficial_targets) {
// only affect mobs we would assist.
if (!(fac <= FACTION_AMIABLE))
if (!(fac <= FACTION_AMIABLE)) {
++iter;
continue;
}
} else {
// affect mobs that are on our hate list, or which have bad faction with us
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS))
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) {
++iter;
continue;
}
}
}
if (angle_start > angle_end) {
if ((heading_to_target >= angle_start && heading_to_target <= 360.0f) ||