Print stats when in debug mode at end of challenge.

This commit is contained in:
Steve 2016-03-01 07:21:31 +00:00
parent c95b56728f
commit e5c5315e62
2 changed files with 29 additions and 0 deletions

View File

@ -31,6 +31,7 @@ static void failChallenge(void);
static void updateChallenges(void);
static char *getFormattedChallengeDescription(const char *format, ...);
char *getChallengeDescription(Challenge *c);
static void printStats(void);
static char descriptionBuffer[MAX_DESCRIPTION_LENGTH];
static const char *challengeDescription[CHALLENGE_MAX];
@ -130,6 +131,31 @@ static void updateChallenges(void)
}
}
}
if (dev.debug)
{
printStats();
}
}
static void printStats(void)
{
int i;
for (i = 0 ; i < STAT_MAX ; i++)
{
if (battle.stats[i])
{
if (i != STAT_TIME)
{
printf("DEBUG: %s=%d\n", getLookupName("STAT_", i), battle.stats[i]);
}
else
{
printf("DEBUG: %s=%s\n", getLookupName("STAT_", i), timeToString(battle.stats[i], 0));
}
}
}
}
static void updateTimeChallenge(Challenge *c)

View File

@ -27,7 +27,10 @@ extern void retreatAllies(void);
extern void retreatEnemies(void);
extern char *getTranslatedString(char *string);
extern char *getFileLocation(char *filename);
extern char *getLookupName(char *prefix, long num);
extern char *timeToString(long millis, int showHours);
extern Dev dev;
extern Battle battle;
extern Entity *player;
extern Game game;