From: Michael Stapelberg Date: Sun, 1 Nov 2009 02:40:41 +0000 (+0100) Subject: calculate money when loading statefile X-Git-Tag: rgb2rv6~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c15e61817a0f5c4e4d28e406d8b3761be32f1cfc;p=c128-kasse calculate money when loading statefile --- diff --git a/src/config.c b/src/config.c index 3ee69bd..5b9a918 100644 --- a/src/config.c +++ b/src/config.c @@ -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)); }