version 1.177 | | version 1.178 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.177 2006/09/09 20:32:12 qal21 Exp $"; | | * "$Id: apply.c,v 1.178 2006/09/10 00:04:35 qal21 Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
static int convert_item(object *item, object *converter) { | | static int convert_item(object *item, object *converter) { |
int nr=0; | | int nr=0; |
object *tmp; | | object *tmp; |
int is_in_shop; | | |
uint32 price_in; | | uint32 price_in; |
| | |
for(tmp = get_map_ob(converter->map, converter->x, converter->y); | | |
tmp != NULL; | | |
tmp = tmp->above) { | | |
if(tmp->type == SHOP_FLOOR) | | |
break; | | |
} | | |
is_in_shop = (tmp != NULL); | | |
| | |
/* We make some assumptions - we assume if it takes money as it type, | | /* We make some assumptions - we assume if it takes money as it type, |
* it wants some amount. We don't make change (ie, if something costs | | * it wants some amount. We don't make change (ie, if something costs |
* 3 gp and player drops a platinum, tough luck) | | * 3 gp and player drops a platinum, tough luck) |
| | |
item->nrof=CONV_NR(converter); | | item->nrof=CONV_NR(converter); |
if(nr) | | if(nr) |
item->nrof*=nr; | | item->nrof*=nr; |
if(is_in_shop) | | if(is_in_shop(converter)) |
SET_FLAG(item,FLAG_UNPAID); | | SET_FLAG(item,FLAG_UNPAID); |
else if(price_in < item->nrof*item->value) { | | else if(price_in < item->nrof*item->value) { |
LOG(llevError, "Broken converter %s at %s (%d, %d) in value %d, out value %d for %s\n", | | LOG(llevError, "Broken converter %s at %s (%d, %d) in value %d, out value %d for %s\n", |
| | |
* but there is never a guarantee that the bottom space on the map is | | * but there is never a guarantee that the bottom space on the map is |
* actually the shop floor. | | * actually the shop floor. |
*/ | | */ |
else if ( ! rv && (tmp = get_map_ob (op->map, op->x, op->y)) != NULL | | else if ( !rv && is_in_shop(op)) { |
&& tmp->type != SHOP_FLOOR) { | | |
opinion = shopkeeper_approval(op->map, op); | | opinion = shopkeeper_approval(op->map, op); |
if ( opinion > 0.9) | | if ( opinion > 0.9) |
new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper gives you a friendly wave."); | | new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper gives you a friendly wave."); |