]> git.sur5r.net Git - c128-kasse/blobdiff - src/config.c
Count the number of sold items when loading itemz-file
[c128-kasse] / 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));
 }