]> git.sur5r.net Git - c128-kasse/commitdiff
calculate money when loading statefile
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 1 Nov 2009 02:40:41 +0000 (03:40 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 1 Nov 2009 02:40:41 +0000 (03:40 +0100)
src/config.c

index 3ee69bde01c7b29a6469ae61e04ec0e116372e8e..5b9a918c85fdcc4bd6ffd8f163e5e357dc45d2cf 100644 (file)
@@ -96,9 +96,12 @@ void load_items() {
 
        if (items_exists) {
                items_sold = 0;
+               money = 0;
                cbm_load("items", (BYTE)8, &status);
-               for (c = 0; c < status.num_items; c++)
+               for (c = 0; c < status.num_items; c++) {
                        items_sold += status.status[c].times_sold;
+                       money += status.status[c].price * status.status[c].times_sold;
+               }
        } else
                memset(&status, 0, sizeof(struct status_array_t));
 }