From b7746b9622a63e6a71cbd8aa9679397cc3bd153f Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 25 Apr 2016 17:20:35 +0100 Subject: [PATCH] Count battle stats as well as game stats when awarding stats trophies. --- src/game/trophies.c | 16 ++++++++-------- src/game/trophies.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/trophies.c b/src/game/trophies.c index 6887a30..eaf866a 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -61,7 +61,7 @@ void initTrophies(void) resetAlert(); } -void initTrophyDisplay(void) +void initTrophiesDisplay(void) { int w, h; Trophy *t; @@ -237,7 +237,7 @@ void doTrophyAlerts(void) } else if (alertTrophy) { - alertRect.x = MIN(alertRect.x + 10, -1); + alertRect.x = MIN(alertRect.x + 32, -1); if (alertRect.x > -150) { @@ -351,15 +351,15 @@ static void loadTrophyData(char *filename) STRNCPY(t->id, cJSON_GetObjectItem(node, "id")->valuestring, MAX_NAME_LENGTH); STRNCPY(t->title, _(cJSON_GetObjectItem(node, "title")->valuestring), MAX_DESCRIPTION_LENGTH); STRNCPY(t->description, _(cJSON_GetObjectItem(node, "description")->valuestring), MAX_DESCRIPTION_LENGTH); - STRNCPY(t->shortDescription, _(cJSON_GetObjectItem(node, "description")->valuestring), SHORT_DESCRIPTION_LENGTH); + STRNCPY(t->shortDescription, _(cJSON_GetObjectItem(node, "description")->valuestring), MAX_NAME_LENGTH); t->value = lookup(cJSON_GetObjectItem(node, "value")->valuestring); t->hidden = getJSONValue(node, "hidden", 0); - if (strlen(t->description) > SHORT_DESCRIPTION_LENGTH) + if (strlen(t->description) > MAX_NAME_LENGTH) { - t->shortDescription[SHORT_DESCRIPTION_LENGTH - 1] = '.'; - t->shortDescription[SHORT_DESCRIPTION_LENGTH - 2] = '.'; - t->shortDescription[SHORT_DESCRIPTION_LENGTH - 3] = '.'; + t->shortDescription[MAX_NAME_LENGTH - 1] = '.'; + t->shortDescription[MAX_NAME_LENGTH - 2] = '.'; + t->shortDescription[MAX_NAME_LENGTH - 3] = '.'; } t->stat = -1; @@ -385,7 +385,7 @@ void awardStatsTrophies(void) for (t = game.trophyHead.next ; t != NULL ; t = t->next) { - if (t->stat != -1 && !t->awarded && game.stats[t->stat] >= t->statValue) + if (t->stat != -1 && !t->awarded && (game.stats[t->stat] + battle.stats[t->stat]) >= t->statValue) { t->awarded = 1; t->awardDate = time(NULL); diff --git a/src/game/trophies.h b/src/game/trophies.h index 77d00ba..ee8e11d 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define SHORT_DESCRIPTION_LENGTH 40 #define TROPHIES_PER_PAGE 4 #include "../common.h" @@ -43,5 +42,6 @@ extern char *timeToDate(long millis); extern void textSize(char *text, int size, int *w, int *h); extern App app; +extern Battle battle; extern Colors colors; extern Game game;