When activating a captial ship, also activate its components.

This commit is contained in:
Steve 2015-12-30 18:43:47 +00:00
parent 4652787b65
commit b095705dd0
5 changed files with 11 additions and 3 deletions

View File

@ -519,7 +519,7 @@ static void loadEngines(Entity *parent, cJSON *engines)
}
}
void updateCapitalShipComponentNames(Entity *parent)
void updateCapitalShipComponentProperties(Entity *parent)
{
Entity *e;
@ -541,6 +541,8 @@ void updateCapitalShipComponentNames(Entity *parent)
sprintf(e->name, "%s (Gun)", parent->name);
break;
}
e->active = parent->active;
}
}
}

View File

@ -428,6 +428,11 @@ void activateEntities(char *names)
if (strcmp(e->name, name) == 0)
{
e->active = 1;
if (e->type == ET_CAPITAL_SHIP)
{
updateCapitalShipComponentProperties(e);
}
}
}

View File

@ -31,6 +31,7 @@ extern void drawRope(Entity *e);
extern void cutRope(Entity *e);
extern void drawShieldHitEffect(Entity *e);
extern void destroyGrid(void);
extern void updateCapitalShipComponentProperties(Entity *parent);
extern App app;
extern Battle battle;

View File

@ -423,7 +423,7 @@ static void loadCapitalShips(cJSON *node)
}
}
updateCapitalShipComponentNames(e);
updateCapitalShipComponentProperties(e);
}
node = node->next;

View File

@ -45,7 +45,7 @@ extern void completeConditions(void);
extern void retreatEnemies(void);
extern void initScript(cJSON *missionJSON);
extern char *getFileLocation(char *filename);
extern void updateCapitalShipComponentNames(Entity *parent);
extern void updateCapitalShipComponentProperties(Entity *parent);
extern Battle battle;
extern Dev dev;