From a3f8e2edc088d6b42c37fcc875cc60e6318457de Mon Sep 17 00:00:00 2001 From: sECuRE Date: Sun, 30 Nov 2008 11:19:57 +0000 Subject: [PATCH] Count the number of sold items when loading itemz-file git-svn-id: https://shell.noname-ev.de/svn/kasse/c128@90 af93e077-1a23-4f1e-9cbe-9382a9d578f5 --- src/config.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index 00dceb1..5de39a4 100644 --- a/src/config.c +++ b/src/config.c @@ -56,9 +56,14 @@ static void lookup_needed_files() { } void load_items() { - if (items_exists) + BYTE c; + + if (items_exists) { + items_sold = 0; cbm_load("items", (BYTE)8, &status); - else + for (c = 0; c < status.num_items; c++) + items_sold += status.status[c].times_sold; + } else memset(&status, 0, sizeof(struct status_array_t)); } -- 2.39.5