From 8bea62967e41aa3da291f47b9ee0f4bb08794777 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 5 Nov 2016 11:46:36 +0100 Subject: [PATCH] calculate income when loading state file fixes #2 --- src/config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)); } -- 2.39.5