Allowed fighter groups to have flags.

This commit is contained in:
Steve 2015-11-15 11:31:43 +00:00
parent 9ce6624fc0
commit af85d1ca5e
1 changed files with 12 additions and 0 deletions

View File

@ -247,6 +247,7 @@ static void loadFighterGroups(cJSON *node)
char **types, *name, *groupName, *type; char **types, *name, *groupName, *type;
int side, scatter, number, active; int side, scatter, number, active;
int i, numTypes; int i, numTypes;
long flags;
float x, y; float x, y;
scatter = 1; scatter = 1;
@ -259,6 +260,7 @@ static void loadFighterGroups(cJSON *node)
while (node) while (node)
{ {
groupName = NULL; groupName = NULL;
flags = -1;
types = toFighterTypeArray(cJSON_GetObjectItem(node, "types")->valuestring, &numTypes); types = toFighterTypeArray(cJSON_GetObjectItem(node, "types")->valuestring, &numTypes);
side = lookup(cJSON_GetObjectItem(node, "side")->valuestring); side = lookup(cJSON_GetObjectItem(node, "side")->valuestring);
@ -282,6 +284,11 @@ static void loadFighterGroups(cJSON *node)
active = cJSON_GetObjectItem(node, "active")->valueint; active = cJSON_GetObjectItem(node, "active")->valueint;
} }
if (cJSON_GetObjectItem(node, "flags"))
{
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring);
}
for (i = 0 ; i < number ; i++) for (i = 0 ; i < number ; i++)
{ {
type = types[rand() % numTypes]; type = types[rand() % numTypes];
@ -293,6 +300,11 @@ static void loadFighterGroups(cJSON *node)
f->active = active; f->active = active;
if (flags != -1)
{
f->flags = flags;
}
STRNCPY(f->name, name, MAX_NAME_LENGTH); STRNCPY(f->name, name, MAX_NAME_LENGTH);
if (groupName) if (groupName)