From: Michael Stapelberg Date: Wed, 9 Oct 2013 18:01:35 +0000 (+0200) Subject: itemz: implement counter reset X-Git-Tag: rgb2rv12 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=946fa5052f1d3cc4fc4077c380cb86ce4c566a00;p=c128-kasse itemz: implement counter reset --- diff --git a/src/itemz.c b/src/itemz.c index 609c76d..591118a 100644 --- a/src/itemz.c +++ b/src/itemz.c @@ -32,7 +32,7 @@ static void itemz_print_screen() { cprintf("Eintrag %2d: %s (%s, %d mal verkauft)\r\n", i, status.status[i].item_name, buffer, status.status[i].times_sold); } - cprintf("\r\nn) Neu d) Loeschen s) Speichern m) Credit Modus q) Beenden\r\n"); + cprintf("\r\nn) Neu d) Loeschen s) Speichern m) Credit Modus q) Beenden\r\nr) Reset des Verkauft-Zaehlers\r\n"); } static void new_item() { @@ -91,6 +91,14 @@ static void delete_item() { status.num_items--; } +static void reset_counters(void) { + BYTE i; + + for (i = 0; i < status.num_items; i++) { + status.status[i].times_sold = 0; + } +} + static void itemz_manager(){ char *c; while(1){ @@ -103,6 +111,8 @@ static void itemz_manager(){ delete_item(); break; case 's': save_items(); break; + case 'r': + reset_counters(); break; case 'm': return; // switch to credit mode case 'q':