sprintf(print_buffer, "%c[%3u] %s - %-" xstr(MAX_ITEM_NAME_LENGTH) "s - %s - %s - %d - an %s\r", 17,
status.transaction_id, time, name, price, rest,
einheiten, (*nickname != '\0' ? nickname : "Unbekannt"));
+ status.transaction_id++;
print_the_buffer();
}
* to NULL if no such credit could be found */
credit = find_credit(nickname);
if (credit != NULL) {
- if ((signed int)credit->credit < ((signed int)price * einheiten)) {
- cprintf("Sorry, %s hat nicht genug Geld :-(\r\n", nickname);
- get_input();
- return 0;
+ while ((signed int)credit->credit < ((signed int)price * einheiten)) {
+ if (format_euro(rest, 10, credit->credit) == NULL) {
+ cprintf("Preis %d konnte nicht umgerechnet werden\r\n", credit->credit);
+ exit(1);
+ }
+ cprintf("\r\n%s hat nicht genug Geld (%s). e) einzahlen a) abbruch \r\n", nickname, rest);
+ c = cgetc();
+ if (c == 'e') {
+ deposit_credit(nickname);
+ } else {
+ return 0;
+ }
}
/* substract money */
credit->credit -= (price * einheiten);