]> git.sur5r.net Git - c128-kasse/commitdiff
show remaining credits when user has not enough credits
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 29 Sep 2012 15:27:52 +0000 (17:27 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 29 Sep 2012 15:27:52 +0000 (17:27 +0200)
src/kasse.c

index 40bfbf5fb3b91d3f928df968ce73273db31e6b3d..977f8017b092a326a722c94c004f0ff6a608febc 100644 (file)
@@ -152,7 +152,11 @@ static signed int buy(char *name, unsigned int price) {
                credit = find_credit(nickname);
                if (credit != NULL) {
                        while ((signed int)credit->credit < ((signed int)price * einheiten)) {
-                               cprintf("%s hat nicht genug Geld. e) einzahlen a) abbruch \r\n", nickname);
+                               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);