Kill missile if its target is dead.
This commit is contained in:
parent
3be2550c89
commit
9c113f2263
|
@ -335,12 +335,12 @@ static void selectNewTarget(Bullet *b)
|
||||||
int i;
|
int i;
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
|
|
||||||
b->target = NULL;
|
|
||||||
|
|
||||||
candidates = getAllEntsWithin(b->x - (SCREEN_WIDTH / 2), b->y - (SCREEN_HEIGHT / 2), SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
|
|
||||||
|
|
||||||
if (app.gameplay.missileReTarget)
|
if (app.gameplay.missileReTarget)
|
||||||
{
|
{
|
||||||
|
b->target = NULL;
|
||||||
|
|
||||||
|
candidates = getAllEntsWithin(b->x - (SCREEN_WIDTH / 2), b->y - (SCREEN_HEIGHT / 2), SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
if (e->type == ET_FIGHTER && e->side != b->owner->side && e->health > 0)
|
if (e->type == ET_FIGHTER && e->side != b->owner->side && e->health > 0)
|
||||||
|
@ -356,6 +356,11 @@ static void selectNewTarget(Bullet *b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no target, just explode */
|
||||||
|
b->life = 0;
|
||||||
|
addMissileExplosion(b);
|
||||||
|
playBattleSound(SND_EXPLOSION_1, b->x, b->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bullet *createBullet(int type, int x, int y, Entity *owner)
|
static Bullet *createBullet(int type, int x, int y, Entity *owner)
|
||||||
|
|
Loading…
Reference in New Issue