Skip to content

Commit

Permalink
Test for DecideRangeAttack MBF21 loop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Oct 15, 2024
1 parent ed36461 commit 0a43bd5
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions source_files/edge/p_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -583,20 +583,21 @@ static bool DecideRangeAttack(MapObject *object)
attack = object->info_->rangeattack_;
else // MBF21 check
{
State *check = states + object->info_->missile_state_;
for (;;)
int missile_check = object->info_->missile_state_;
if (missile_check)
{
if (check->action && (check->action == A_MonsterProjectile || check->action == A_MonsterBulletAttack))
for (StateRange group : object->info_->state_grp_)
{
attack = (const AttackDefinition *)check->action_par;
break;
}
else
{
if (check->nextstate)
check = states + check->nextstate;
else
break;
for (int state_check = missile_check; state_check < group.last; state_check++)
{
State *check = states + state_check;
if (check && check->action && (check->action == A_MonsterProjectile || check->action == A_MonsterBulletAttack))
{
// TODO: Store this to avoid repeat checks
attack = (const AttackDefinition *)check->action_par;
break;
}
}
}
}
}
Expand Down

0 comments on commit 0a43bd5

Please sign in to comment.