cheevos: cancel lboards on reset

This commit is contained in:
meleu 2019-02-09 23:12:06 -02:00
parent a49d0a50b9
commit 846ca5fd3b
2 changed files with 22 additions and 18 deletions

View File

@ -698,22 +698,27 @@ static void cheevos_test_leaderboards(void)
void cheevos_reset_game(void) void cheevos_reset_game(void)
{ {
cheevos_cheevo_t* cheevo = NULL; cheevos_cheevo_t* cheevo;
int i, count; cheevos_lboard_t* lboard;
unsigned i;
cheevo = cheevos_locals.core; cheevo = cheevos_locals.core;
for (i = 0; i < cheevos_locals.patchdata.core_count; i++, cheevo++)
for (i = 0, count = cheevos_locals.patchdata.core_count; i < count; i++, cheevo++)
{ {
cheevo->last = 1; cheevo->last = 1;
} }
cheevo = cheevos_locals.unofficial; cheevo = cheevos_locals.unofficial;
for (i = 0; i < cheevos_locals.patchdata.unofficial_count; i++, cheevo++)
for (i = 0, count = cheevos_locals.patchdata.unofficial_count; i < count; i++, cheevo++)
{ {
cheevo->last = 1; cheevo->last = 1;
} }
lboard = cheevos_locals.lboards;
for (i = 0; i < cheevos_locals.patchdata.lboard_count; i++, lboard++)
{
lboard->active = 0;
}
} }
void cheevos_populate_menu(void* data) void cheevos_populate_menu(void* data)

View File

@ -2056,22 +2056,21 @@ static int cheevos_deactivate_unlocks(const char* json, unsigned mode)
void cheevos_reset_game(void) void cheevos_reset_game(void)
{ {
cheevo_t *end = NULL; cheevo_t *cheevo;
cheevo_t *cheevo = cheevos_locals.core.cheevos; cheevos_leaderboard_t *lboard;
unsigned i;
if (!cheevo) cheevo = cheevos_locals.core.cheevos;
return; for (i = 0; i < cheevos_locals.core.count; i++, cheevo++)
end = cheevo + cheevos_locals.core.count;
for (; cheevo < end; cheevo++)
cheevo->last = 1; cheevo->last = 1;
cheevo = cheevos_locals.unofficial.cheevos; cheevo = cheevos_locals.unofficial.cheevos;
end = cheevo + cheevos_locals.unofficial.count; for (i = 0; i < cheevos_locals.unofficial.count; i++, cheevo++)
for (; cheevo < end; cheevo++)
cheevo->last = 1; cheevo->last = 1;
lboard = cheevos_locals.leaderboards;
for (i = 0; i < cheevos_locals.lboard_count; i++, lboard++)
lboard->active = 0;
} }
void cheevos_populate_menu(void *data) void cheevos_populate_menu(void *data)