Capital ship bug fixes.

This commit is contained in:
Steve 2016-04-02 10:47:44 +01:00
parent 67c7bc7d55
commit c555aeccbe
3 changed files with 8 additions and 16 deletions

View File

@ -384,6 +384,7 @@ static void loadCapitalShipDef(char *filename)
e->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint; e->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint;
e->texture = getTexture(cJSON_GetObjectItem(root, "texture")->valuestring); e->texture = getTexture(cJSON_GetObjectItem(root, "texture")->valuestring);
e->speed = 1; e->speed = 1;
e->systemPower = MAX_SYSTEM_POWER;
e->action = think; e->action = think;
e->die = die; 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; Entity *e;
@ -580,18 +581,9 @@ void updateCapitalShipComponentProperties(Entity *parent, long flags, int addFla
e->active = parent->active; e->active = parent->active;
if (flags != -1) if (flags & EF_DISABLED)
{ {
if (addFlags) e->flags |= EF_DISABLED;
{
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);
}
} }
} }
} }
@ -669,7 +661,7 @@ void loadCapitalShips(cJSON *node)
} }
} }
updateCapitalShipComponentProperties(e, flags, addFlags); updateCapitalShipComponentProperties(e, flags);
} }
node = node->next; node = node->next;

View File

@ -467,7 +467,7 @@ void activateEntities(char *names)
if (e->type == ET_CAPITAL_SHIP) 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) if (e->type == ET_CAPITAL_SHIP)
{ {
updateCapitalShipComponentProperties(e); updateCapitalShipComponentProperties(e, 0);
} }
} }
} }

View File

@ -34,7 +34,7 @@ extern void cutRope(Entity *e);
extern void drawShieldHitEffect(Entity *e); extern void drawShieldHitEffect(Entity *e);
extern void removeFromQuadtree(Entity *e, Quadtree *root); extern void removeFromQuadtree(Entity *e, Quadtree *root);
extern void addToQuadtree(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 App app;
extern Battle battle; extern Battle battle;