Allow AI Flags to be set in mission data.

This commit is contained in:
Steve 2015-12-02 07:24:12 +00:00
parent b3c2313235
commit 26c4bd4aea
1 changed files with 12 additions and 1 deletions

View File

@ -199,7 +199,7 @@ static void loadFighters(cJSON *node)
char **types, *name, *groupName, *type;
int side, scatter, number, active;
int i, numTypes;
long flags;
long flags, aiFlags;
float x, y;
if (node)
@ -211,6 +211,7 @@ static void loadFighters(cJSON *node)
name = NULL;
groupName = NULL;
flags = -1;
aiFlags = -1;
scatter = 1;
active = 1;
number = 1;
@ -250,6 +251,11 @@ static void loadFighters(cJSON *node)
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring);
}
if (cJSON_GetObjectItem(node, "aiFlags"))
{
aiFlags = flagsToLong(cJSON_GetObjectItem(node, "aiFlags")->valuestring);
}
for (i = 0 ; i < number ; i++)
{
type = types[rand() % numTypes];
@ -266,6 +272,11 @@ static void loadFighters(cJSON *node)
f->flags = flags;
}
if (aiFlags != -1)
{
f->aiFlags = aiFlags;
}
if (name)
{
STRNCPY(f->name, name, MAX_NAME_LENGTH);