Don't load trophies with an id that leads with an underscore for now.

This commit is contained in:
Steve 2016-04-26 08:16:52 +01:00
parent d4ddde9be4
commit f4fc43b017
1 changed files with 36 additions and 28 deletions

View File

@ -173,7 +173,7 @@ void drawTrophies(void)
blitScaled(trophyIcons[t->value], x, y, 64, 64);
drawText(x + 85, y - 10, 20, TA_LEFT, colors.white, t->title);
drawText(x + 85, y + 20, 18, TA_LEFT, colors.lightGrey, t->description);
drawText(x + 85, y + 48, 18, TA_LEFT, colors.yellow, t->awardDateStr);
drawText(x + 85, y + 48, 18, TA_LEFT, colors.lightGrey, t->awardDateStr);
}
else
{
@ -237,7 +237,7 @@ void doTrophyAlerts(void)
}
else if (alertTrophy)
{
alertRect.x = MIN(alertRect.x + 32, -1);
alertRect.x = MIN(alertRect.x + 16, -1);
if (alertRect.x > -150)
{
@ -344,6 +344,8 @@ static void loadTrophyData(char *filename)
tail = &game.trophyHead;
for (node = root->child ; node != NULL ; node = node->next)
{
if (cJSON_GetObjectItem(node, "id")->valuestring[0] != '_')
{
t = malloc(sizeof(Trophy));
memset(t, 0, sizeof(Trophy));
@ -374,6 +376,7 @@ static void loadTrophyData(char *filename)
tail->next = t;
tail = t;
}
}
cJSON_Delete(root);
free(text);
@ -401,6 +404,11 @@ void awardCampaignTrophies(void)
int completed, i, len;
StarSystem *starSystem;
if (game.completedMissions)
{
awardTrophy("CAMPAIGN_1");
}
/* check % of missions completed */
completed = getPercent(game.completedMissions, game.totalMissions);
sprintf(trophyId, "CAMPAIGN_%d", completed);