From da692862b9e168dbdc4343e3f79596ae45569255 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 10 Dec 2015 11:11:32 +0000 Subject: [PATCH] Include cap ships in force counts. --- src/battle/entities.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/battle/entities.c b/src/battle/entities.c index d6fc3a1..79015c5 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -88,18 +88,6 @@ void doEntities(void) { case ET_FIGHTER: doFighter(); - - if (e->health > 0) - { - if (e->side == SIDE_ALLIES) - { - numActiveAllies++; - } - else - { - numActiveEnemies++; - } - } break; default: @@ -162,15 +150,25 @@ void doEntities(void) } } - if (e->type == ET_FIGHTER && (battle.epic || e->active) && !(e->flags & EF_NO_EPIC)) + if (e->type == ET_FIGHTER || e->type == ET_CAPITAL_SHIP) { if (e->side == SIDE_ALLIES) { numAllies++; + + if (e->health > 0 && (battle.epic || e->active) && !(e->flags & EF_NO_EPIC)) + { + numActiveAllies++; + } } else { numEnemies++; + + if (e->health > 0 && (battle.epic || e->active) && !(e->flags & EF_NO_EPIC)) + { + numActiveEnemies++; + } } } @@ -271,7 +269,7 @@ static void alignComponents(void) for (e = battle.entityHead.next ; e != NULL ; e = e->next) { - if (e->type == ET_CAPITAL_SHIP_COMPONENT || e->type == ET_CAPITAL_SHIP_GUN) + if (e->type == ET_CAPITAL_SHIP_COMPONENT || e->type == ET_CAPITAL_SHIP_GUN || e->type == ET_CAPITAL_SHIP_ENGINE) { s = sin(TO_RAIDANS(e->owner->angle)); c = cos(TO_RAIDANS(e->owner->angle)); @@ -285,15 +283,10 @@ static void alignComponents(void) e->x = x; e->y = y; - if (e->type == ET_CAPITAL_SHIP_COMPONENT) + if (e->type == ET_CAPITAL_SHIP_COMPONENT || e->type == ET_CAPITAL_SHIP_ENGINE) { e->angle = e->owner->angle; } - - if (e->owner->alive == ALIVE_DYING) - { - e->alive = ALIVE_DEAD; - } } } }