From 8e0ee72283cfcfebb3b64aa73ae9776b54573f0c Mon Sep 17 00:00:00 2001 From: meleu Date: Wed, 22 Nov 2017 12:56:17 -0200 Subject: [PATCH] cheevos: do not show "0 of 0 cheevos unlocked" msg **This will happen only if `cheevos_verbose_enable = true`.** When loading a game tha doesn't have any achievement, instead of showing an OSD message saying "You have 0 of 0 achievements unlocked." just say "This game doesn't have any achievement." I've just added an `if(cheevos_locals.core.count > 0)` and added indentation. The diff makes it look like it got more changes than it actually got. --- cheevos/cheevos.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 9ad63a365c..16a9e01775 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -2830,25 +2830,31 @@ static int cheevos_iterate(coro_t* coro) if(CHEEVOS_VAR_SETTINGS->bools.cheevos_verbose_enable) { - const cheevo_t* cheevo = cheevos_locals.core.cheevos; - const cheevo_t* end = cheevo + cheevos_locals.core.count; - int number_of_unlocked = cheevos_locals.core.count; - int mode; - char msg[256]; + if(cheevos_locals.core.count > 0) + { + const cheevo_t* cheevo = cheevos_locals.core.cheevos; + const cheevo_t* end = cheevo + cheevos_locals.core.count; + int number_of_unlocked = cheevos_locals.core.count; + int mode; + char msg[256]; - if(CHEEVOS_VAR_SETTINGS->bools.cheevos_hardcore_mode_enable) - mode = CHEEVOS_ACTIVE_HARDCORE; + if(CHEEVOS_VAR_SETTINGS->bools.cheevos_hardcore_mode_enable) + mode = CHEEVOS_ACTIVE_HARDCORE; + else + mode = CHEEVOS_ACTIVE_SOFTCORE; + + for(; cheevo < end; cheevo++) + if(cheevo->active & mode) + number_of_unlocked--; + + snprintf(msg, sizeof(msg), "You have %d of %d achievements unlocked.", + number_of_unlocked, cheevos_locals.core.count); + msg[sizeof(msg) - 1] = 0; + runloop_msg_queue_push(msg, 0, 6 * 60, false); + } else - mode = CHEEVOS_ACTIVE_SOFTCORE; + runloop_msg_queue_push("This game doesn't have any achievement.", 0, 5 * 60, false); - for(; cheevo < end; cheevo++) - if(cheevo->active & mode) - number_of_unlocked--; - - snprintf(msg, sizeof(msg), "You have %d of %d achievements unlocked.", - number_of_unlocked, cheevos_locals.core.count); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 6 * 60, false); } CORO_STOP();