Added id to objective, to allow script to function in non-English languages.

This commit is contained in:
Steve 2016-03-16 06:54:34 +00:00
parent 30fa446006
commit 4ef796bf92
3 changed files with 5 additions and 3 deletions

View File

@ -205,7 +205,7 @@ void activateObjectives(char *objectives)
{
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
{
if (strcmp(token, o->description) == 0)
if (strcmp(token, o->id) == 0)
{
addHudMessage(colors.cyan, _("New Objective : %s"), o->description);
o->active = 1;

View File

@ -329,6 +329,7 @@ static void loadObjectives(cJSON *node)
battle.objectiveTail->next = o;
battle.objectiveTail = o;
STRNCPY(o->id, cJSON_GetObjectItem(node, "description")->valuestring, MAX_DESCRIPTION_LENGTH);
STRNCPY(o->description, _(cJSON_GetObjectItem(node, "description")->valuestring), MAX_DESCRIPTION_LENGTH);
STRNCPY(o->targetName, cJSON_GetObjectItem(node, "targetName")->valuestring, MAX_NAME_LENGTH);
o->targetValue = cJSON_GetObjectItem(node, "targetValue")->valueint;
@ -793,8 +794,8 @@ static void loadSpawners(cJSON *node)
s->types = toTypeArray(cJSON_GetObjectItem(node, "types")->valuestring, &s->numTypes);
s->side = lookup(cJSON_GetObjectItem(node, "side")->valuestring);
s->interval = cJSON_GetObjectItem(node, "interval")->valueint * FPS;
s->limit = cJSON_GetObjectItem(node, "limit")->valueint;
s->total = cJSON_GetObjectItem(node, "total")->valueint;
s->limit = getJSONValue(node, "limit", 0);
s->total = getJSONValue(node, "total", 0);
s->step = cJSON_GetObjectItem(node, "step")->valueint;
s->offscreen = getJSONValue(node, "offscreen", 0);
s->active = active = getJSONValue(node, "active", 1);

View File

@ -226,6 +226,7 @@ struct Location {
struct Objective {
int active;
char id[MAX_DESCRIPTION_LENGTH];
char description[MAX_DESCRIPTION_LENGTH];
char targetName[MAX_NAME_LENGTH];
int targetType;