From c555aeccbe16d9f0f3f4c243e64225784287d885 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 2 Apr 2016 10:47:44 +0100 Subject: [PATCH] Capital ship bug fixes. --- src/battle/capitalShips.c | 18 +++++------------- src/battle/entities.c | 4 ++-- src/battle/entities.h | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/battle/capitalShips.c b/src/battle/capitalShips.c index 5c524e9..ecdc1d3 100644 --- a/src/battle/capitalShips.c +++ b/src/battle/capitalShips.c @@ -384,6 +384,7 @@ static void loadCapitalShipDef(char *filename) e->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint; e->texture = getTexture(cJSON_GetObjectItem(root, "texture")->valuestring); e->speed = 1; + e->systemPower = MAX_SYSTEM_POWER; e->action = think; e->die = die; @@ -555,7 +556,7 @@ static void loadEngines(Entity *parent, cJSON *engines) } } -void updateCapitalShipComponentProperties(Entity *parent, long flags, int addFlags) +void updateCapitalShipComponentProperties(Entity *parent, long flags) { Entity *e; @@ -580,18 +581,9 @@ void updateCapitalShipComponentProperties(Entity *parent, long flags, int addFla e->active = parent->active; - if (flags != -1) + if (flags & EF_DISABLED) { - if (addFlags) - { - e->flags |= flags; - } - else - { - e->flags = flags; - - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Flags for '%s' (%s) replaced", e->name, e->defName); - } + e->flags |= EF_DISABLED; } } } @@ -669,7 +661,7 @@ void loadCapitalShips(cJSON *node) } } - updateCapitalShipComponentProperties(e, flags, addFlags); + updateCapitalShipComponentProperties(e, flags); } node = node->next; diff --git a/src/battle/entities.c b/src/battle/entities.c index 3a163c2..4b41669 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -467,7 +467,7 @@ void activateEntities(char *names) if (e->type == ET_CAPITAL_SHIP) { - updateCapitalShipComponentProperties(e); + updateCapitalShipComponentProperties(e, 0); } } } @@ -495,7 +495,7 @@ void activateEntityGroups(char *groupNames) if (e->type == ET_CAPITAL_SHIP) { - updateCapitalShipComponentProperties(e); + updateCapitalShipComponentProperties(e, 0); } } } diff --git a/src/battle/entities.h b/src/battle/entities.h index 0d9f070..6466510 100644 --- a/src/battle/entities.h +++ b/src/battle/entities.h @@ -34,7 +34,7 @@ extern void cutRope(Entity *e); extern void drawShieldHitEffect(Entity *e); extern void removeFromQuadtree(Entity *e, Quadtree *root); extern void addToQuadtree(Entity *e, Quadtree *root); -extern void updateCapitalShipComponentProperties(Entity *parent); +extern void updateCapitalShipComponentProperties(Entity *parent, long flags); extern App app; extern Battle battle;