]> git.sur5r.net Git - c128-kasse/commitdiff
Count the number of sold items when loading itemz-file
authorsECuRE <sECuRE@af93e077-1a23-4f1e-9cbe-9382a9d578f5>
Sun, 30 Nov 2008 11:19:57 +0000 (11:19 +0000)
committersECuRE <sECuRE@af93e077-1a23-4f1e-9cbe-9382a9d578f5>
Sun, 30 Nov 2008 11:19:57 +0000 (11:19 +0000)
git-svn-id: https://shell.noname-ev.de/svn/kasse/c128@90 af93e077-1a23-4f1e-9cbe-9382a9d578f5

src/config.c

index 00dceb1d53c75ee7cc335d006b371af39561f041..5de39a4875b6bfbbd186f5916a0bdccf04ade703 100644 (file)
@@ -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));
 }