Fix a potential crash in ai_run_melee() and ai_run_missile().

This was found and fixed by Maraakate.
This commit is contained in:
Yamagi Burmeister 2017-09-07 18:11:10 +02:00
parent 891e75c568
commit 02942e9544
1 changed files with 13 additions and 8 deletions

View File

@ -1045,10 +1045,13 @@ ai_run_melee(edict_t *self)
}
if (FacingIdeal(self))
{
if (self->monsterinfo.melee)
{
self->monsterinfo.melee(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}
/*
@ -1071,15 +1074,17 @@ ai_run_missile(edict_t *self)
}
if (FacingIdeal(self))
{
if (self->monsterinfo.attack)
{
self->monsterinfo.attack(self);
if ((self->monsterinfo.attack_state == AS_MISSILE) ||
(self->monsterinfo.attack_state == AS_BLIND))
{
(self->monsterinfo.attack_state == AS_BLIND)) {
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}
}
/*
@ -1115,7 +1120,7 @@ ai_run_slide(edict_t *self, float distance)
}
/* clamp maximum sideways move for non flyers to make them look less jerky */
if (!self->flags & FL_FLY)
if (!(self->flags & FL_FLY))
{
distance = min(distance, 0.8);
}