[Fix] Beam stops moving if enemy got destroyed.

This commit is contained in:
Allanis 2013-10-04 00:02:33 +01:00
parent 4340b8042c
commit 1177685e62

View File

@ -233,18 +233,19 @@ static void think_beam(Weapon* w, const double dt) {
w->solid->pos.x = p->solid->pos.x;
w->solid->pos.y = p->solid->pos.y;
t = pilot_get(w->target);
if(t == NULL) {
w->solid->dir_vel = 0.;
return;
}
/* Handle aiming. */
switch(w->outfit->type) {
case OUTFIT_TYPE_BEAM:
w->solid->dir = p->solid->dir;
break;
case OUTFIT_TYPE_TURRET_BEAM:
/* Get target, if target is dead beam stops moving. */
t = pilot_get(w->target);
if(t == NULL) {
w->solid->dir_vel = 0.;
return;
}
if(w->target == w->parent) /* Invalid target, try to follow shooter. */
diff = angle_diff(w->solid->dir, p->solid->dir);
else