version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_shop_c = | | * static char *rcsid_shop_c = |
* "$Id: shop.c,v 1.10 2001/06/04 06:41:02 mwedel Exp $"; | | * "$Id: shop.c,v 1.11 2001/06/07 06:08:23 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
{ | | { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | |
if (*numitems==*numallocated) { | | |
items=realloc(items, sizeof(shopinv)*(*numallocated+10)); | | |
*numallocated+=10; | | |
} | | |
/* clear unpaid flag so that doesn't come up in query | | /* clear unpaid flag so that doesn't come up in query |
* string. We clear nrof so that we can better sort | | * string. We clear nrof so that we can better sort |
* the object names. | | * the object names. |
| | |
sprintf(buf,"%s %s",query_base_name(tmp,0),describe_item(tmp)); | | sprintf(buf,"%s %s",query_base_name(tmp,0),describe_item(tmp)); |
items[*numitems].item_sort = strdup_local(buf); | | items[*numitems].item_sort = strdup_local(buf); |
sprintf(buf,"%s %s",query_name(tmp),describe_item(tmp)); | | sprintf(buf,"%s %s",query_name(tmp),describe_item(tmp)); |
items[*numitems++].item_real = strdup_local(buf); | | items[*numitems].item_real = strdup_local(buf); |
| | (*numitems)++; |
break; | | break; |
| | |
default: | | default: |
items[*numitems].item_sort = strdup_local(query_base_name(tmp, 0)); | | items[*numitems].item_sort = strdup_local(query_base_name(tmp, 0)); |
items[*numitems++].item_real = strdup_local(query_name(tmp)); | | items[*numitems].item_real = strdup_local(query_name(tmp)); |
| | (*numitems)++; |
break; | | break; |
} | | } |
| | SET_FLAG(tmp, FLAG_UNPAID); |
} | | } |
| | |
void shop_listing(object *op) | | void shop_listing(object *op) |
| | |
| | |
while (stack) { | | while (stack) { |
if (QUERY_FLAG(stack, FLAG_UNPAID)) { | | if (QUERY_FLAG(stack, FLAG_UNPAID)) { |
| | if (numitems==numallocated) { |
| | items=realloc(items, sizeof(shopinv)*(numallocated+10)); |
| | numallocated+=10; |
| | } |
add_shop_item(stack, items, &numitems, &numallocated); | | add_shop_item(stack, items, &numitems, &numallocated); |
} | | } |
stack = stack->above; | | stack = stack->above; |