From: Michael Stapelberg Date: Sat, 5 Nov 2016 10:46:36 +0000 (+0100) Subject: calculate income when loading state file X-Git-Tag: rgb2rv17~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8bea62967e41aa3da291f47b9ee0f4bb08794777;p=c128-kasse calculate income when loading state file fixes #2 --- diff --git a/src/config.c b/src/config.c index c7c9914..05e06c8 100644 --- a/src/config.c +++ b/src/config.c @@ -84,9 +84,12 @@ void load_items(void) { 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)); }