From: sECuRE Date: Sun, 30 Nov 2008 11:19:57 +0000 (+0000) Subject: Count the number of sold items when loading itemz-file X-Git-Tag: rgb2rv6~19 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a3f8e2edc088d6b42c37fcc875cc60e6318457de;p=c128-kasse 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 --- 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)); }