forked from brmlab/brmbar-github
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
|
// scan items
|
||||||
for (i = 0; i < items_count; ++i) {
|
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 (!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;
|
last_item = i;
|
||||||
printf("\n%s %d Kc\n\n", items[i].name, abs(items[i].price));
|
printf("\n%s %d Kc\n\n", items[i].name, abs(items[i].price));
|
||||||
} else {
|
} else
|
||||||
|
if (items[i].price == 0) {
|
||||||
last_item = -1;
|
last_item = -1;
|
||||||
printf("\n%s\n\n", items[i].name);
|
printf("\n%s\n\n", items[i].name);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +121,11 @@ void read_input()
|
||||||
if (last_item == -1) {
|
if (last_item == -1) {
|
||||||
balance = modify_credit(people[i], 0);
|
balance = modify_credit(people[i], 0);
|
||||||
printf("has %d Kc.\n\n", balance);
|
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 {
|
} else {
|
||||||
balance = modify_credit(people[i], items[last_item].price);
|
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);
|
printf("has ordered %s for %d Kc and now has %d Kc.\n\n", items[last_item].name, abs(items[last_item].price), balance);
|
||||||
|
|
|
@ -4,7 +4,8 @@ $10;Credit 100;100
|
||||||
$20;Credit 200;200
|
$20;Credit 200;200
|
||||||
$50;Credit 500;500
|
$50;Credit 500;500
|
||||||
$1k;Credit 1000;1000
|
$1k;Credit 1000;1000
|
||||||
STS;Show status;0
|
SHW;SHOW credit;0
|
||||||
|
RST;RESET credit;30000
|
||||||
4029764001807;Club Mate 0.5L;-35
|
4029764001807;Club Mate 0.5L;-35
|
||||||
4029764001821;Club Mate 0.33L;-25
|
4029764001821;Club Mate 0.33L;-25
|
||||||
5018374350930;Tesco Baked Beans in Tomato Sauce;-20
|
5018374350930;Tesco Baked Beans in Tomato Sauce;-20
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
abyssal
|
abyssal
|
||||||
alexka
|
alexka
|
||||||
axtheb
|
axtheb
|
||||||
|
aym
|
||||||
b00lean
|
b00lean
|
||||||
biiter
|
biiter
|
||||||
blami
|
blami
|
||||||
|
@ -22,8 +23,9 @@ prusajr
|
||||||
rainbof
|
rainbof
|
||||||
ruza
|
ruza
|
||||||
sargon
|
sargon
|
||||||
|
shady
|
||||||
|
stevko
|
||||||
stick
|
stick
|
||||||
swez
|
|
||||||
tma
|
tma
|
||||||
tomsuch
|
tomsuch
|
||||||
tutchek
|
tutchek
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue