1 | /* |
1 | /* |
2 | * static char *rcsid_shop_c = |
2 | * static char *rcsid_shop_c = |
3 | * "$Id: shop.c,v 1.2 2006/05/24 01:39:03 pippijn Exp $"; |
3 | * "$Id: shop.c,v 1.3 2006/05/24 01:51:09 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
668 | else item = NULL; |
668 | else item = NULL; |
669 | } |
669 | } |
670 | if (unpaid_price > player_wealth) { |
670 | if (unpaid_price > player_wealth) { |
671 | char buf[MAX_BUF], coinbuf[MAX_BUF]; |
671 | char buf[MAX_BUF], coinbuf[MAX_BUF]; |
672 | int denominations = 0; |
672 | int denominations = 0; |
|
|
673 | int has_coins = NUM_COINS; |
673 | sprintf(buf, "You have %d unpaid items that would cost you %s, but you only have", |
674 | sprintf(buf, "You have %d unpaid items that would cost you %s, but you", |
674 | unpaid_count, cost_string_from_value(unpaid_price)); |
675 | unpaid_count, cost_string_from_value(unpaid_price)); |
|
|
676 | for (i=0; i< NUM_COINS; i++) { |
|
|
677 | if (coincount[i] == 0) { |
|
|
678 | has_coins--; |
|
|
679 | } |
|
|
680 | } |
|
|
681 | if (has_coins == 0) { |
|
|
682 | strcat (buf, " have nothing to spend."); |
|
|
683 | new_draw_info(NDI_UNIQUE, 0, pl, buf); |
|
|
684 | return 0; |
|
|
685 | } |
675 | for (i=0; i< NUM_COINS; i++) { |
686 | for (i=0; i< NUM_COINS; i++) { |
676 | if (coincount[i] > 0 && coins[i]) { |
687 | if (coincount[i] > 0 && coins[i]) { |
677 | denominations++; |
688 | denominations++; |
678 | sprintf(coinbuf, " %d %s,", coincount[i], find_archetype(coins[i])->clone.name_pl); |
689 | sprintf(coinbuf, " %d %s,", coincount[i], find_archetype(coins[i])->clone.name_pl); |
679 | strcat (buf, coinbuf); |
690 | strcat (buf, coinbuf); |