diff --git a/brmbar.c b/brmbar.c index 962e5e1..60d3eec 100644 --- a/brmbar.c +++ b/brmbar.c @@ -98,10 +98,15 @@ void read_input() // scan items for (i = 0; i < items_count; ++i) { if (!strncmp(buf, items[i].ean, strlen(items[i].ean)) && strlen(items[i].ean)+1 == strlen(buf)) { - if (items[i].price) { + if (items[i].price == 30000) { + last_item = -2; + printf("\n%s\n\n", items[i].name); + } else + if (items[i].price > 0) { last_item = i; printf("\n%s %d Kc\n\n", items[i].name, abs(items[i].price)); - } else { + } else + if (items[i].price == 0) { last_item = -1; printf("\n%s\n\n", items[i].name); } @@ -116,6 +121,11 @@ void read_input() if (last_item == -1) { balance = modify_credit(people[i], 0); printf("has %d Kc.\n\n", balance); + } else + if (last_item == -2) { + balance = modify_credit(people[i], 0); + modify_credit(people[i], -balance); + printf("has credit set to 0 Kc.\n\n"); } else { balance = modify_credit(people[i], items[last_item].price); printf("has ordered %s for %d Kc and now has %d Kc.\n\n", items[last_item].name, abs(items[last_item].price), balance); diff --git a/items.txt b/items.txt index 7edda55..fd35033 100644 --- a/items.txt +++ b/items.txt @@ -4,7 +4,8 @@ $10;Credit 100;100 $20;Credit 200;200 $50;Credit 500;500 $1k;Credit 1000;1000 -STS;Show status;0 +SHW;SHOW credit;0 +RST;RESET credit;30000 4029764001807;Club Mate 0.5L;-35 4029764001821;Club Mate 0.33L;-25 5018374350930;Tesco Baked Beans in Tomato Sauce;-20 diff --git a/people.txt b/people.txt index a685f94..54f0348 100644 --- a/people.txt +++ b/people.txt @@ -1,6 +1,7 @@ abyssal alexka axtheb +aym b00lean biiter blami @@ -22,8 +23,9 @@ prusajr rainbof ruza sargon +shady +stevko stick -swez tma tomsuch tutchek