| version 1.12 | | version 1.13 |
|---|
| | |
| /* | | /* |
| * static char *rcsid_shop_c = | | * static char *rcsid_shop_c = |
| * "$Id: shop.c,v 1.12 2001/07/14 04:11:18 mwedel Exp $"; | | * "$Id: shop.c,v 1.13 2001/10/21 09:07:12 gros Exp $"; |
| */ | | */ |
| | | |
| /* | | /* |
| | |
| } | | } |
| return total; | | return total; |
| } | | } |
| | | /* TCHIZE: This function takes the amount of money from the * |
| | | * the player inventory and from it's various pouches using the * |
| | | * pay_from_container function. * |
| | | * returns 0 if not possible. 1 if success */ |
| | | int pay_for_amount(int to_pay,object *pl) { |
| | | object *pouch; |
| | | |
| | | if (to_pay==0) return 1; |
| | | if(to_pay>query_money(pl)) return 0; |
| | | |
| | | to_pay = pay_from_container(NULL, pl, to_pay); |
| | | |
| | | for (pouch=pl->inv; (pouch!=NULL) && (to_pay>0); pouch=pouch->below) { |
| | | if (pouch->type == CONTAINER |
| | | && QUERY_FLAG(pouch, FLAG_APPLIED) |
| | | && (pouch->race == NULL || strstr(pouch->race, "gold"))) { |
| | | to_pay = pay_from_container(NULL, pouch, to_pay); |
| | | } |
| | | } |
| | | |
| | | #ifndef REAL_WIZ |
| | | if(QUERY_FLAG(pl,FLAG_WAS_WIZ)) |
| | | SET_FLAG(op, FLAG_WAS_WIZ); |
| | | #endif |
| | | fix_player(pl); |
| | | return 1; |
| | | } |
| | | |
| /* DAMN: This is now a wrapper for pay_from_container, which is * | | /* DAMN: This is now a wrapper for pay_from_container, which is * |
| * called for the player, then for each active container that can hold * | | * called for the player, then for each active container that can hold * |