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