mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
small changes
This commit is contained in:
parent
819dee4e7d
commit
9d4739bae0
3 changed files with 17 additions and 4 deletions
14
brmbar.c
14
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue