From 108a41310c2a9bf9f6c3630463716c970e1ce665 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 23 May 2016 09:18:10 +0100 Subject: [PATCH] Disable capital ship itself, when gun and engines are destroyed (not just components). --- src/battle/capitalShips.c | 4 ++-- src/battle/capitalShips.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/battle/capitalShips.c b/src/battle/capitalShips.c index 2b9ae93..7e3c1c4 100644 --- a/src/battle/capitalShips.c +++ b/src/battle/capitalShips.c @@ -135,7 +135,7 @@ static void think(void) self->angle += dir; - self->angle = fmod(self->angle, 360); + self->angle = mod(self->angle, 360); } applyFighterThrust(); @@ -387,7 +387,7 @@ static void disable(void) for (e = battle.entityHead.next ; e != NULL ; e = e->next) { - if (e->owner == self->owner) + if (e->owner == self->owner || e == self->owner) { e->systemPower = 0; e->flags |= EF_DISABLED; diff --git a/src/battle/capitalShips.h b/src/battle/capitalShips.h index 8cfb9d9..00882a5 100644 --- a/src/battle/capitalShips.h +++ b/src/battle/capitalShips.h @@ -49,6 +49,7 @@ extern void addLargeExplosion(void); extern char **toTypeArray(char *types, int *numTypes); extern void updateCondition(char *name, int type); extern void addMessageBox(char *title, char *body, int type); +extern float mod(float n, float x); extern Battle battle; extern Entity *player;