Trophy debugging.
This commit is contained in:
parent
ba81b19c31
commit
d3e7a370d2
|
@ -344,6 +344,7 @@ static void loadTrophyData(char *filename)
|
|||
cJSON *root, *node;
|
||||
char *text;
|
||||
Trophy *t, *tail;
|
||||
int count[TROPHY_MAX];
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Loading %s", filename);
|
||||
|
||||
|
@ -352,6 +353,8 @@ static void loadTrophyData(char *filename)
|
|||
|
||||
tail = &game.trophyHead;
|
||||
|
||||
memset(count, 0, sizeof(int) * TROPHY_MAX);
|
||||
|
||||
for (node = root->child ; node != NULL ; node = node->next)
|
||||
{
|
||||
if (cJSON_GetObjectItem(node, "id")->valuestring[0] != '_')
|
||||
|
@ -374,11 +377,16 @@ static void loadTrophyData(char *filename)
|
|||
t->statValue = cJSON_GetObjectItem(node, "statValue")->valueint;
|
||||
}
|
||||
|
||||
count[t->value]++;
|
||||
count[TROPHY_UNEARNED]++;
|
||||
|
||||
tail->next = t;
|
||||
tail = t;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Trophies (%d) [Bronze=%d, Silver=%d, Gold=%d, Platinum=%d]", count[TROPHY_UNEARNED], count[TROPHY_BRONZE], count[TROPHY_SILVER], count[TROPHY_GOLD], count[TROPHY_PLATINUM]);
|
||||
|
||||
cJSON_Delete(root);
|
||||
free(text);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue