version 1.21 | | version 1.22 |
---|
| | |
| | |
/* | | /* |
* static char *rcs_treasure_c = | | * static char *rcs_treasure_c = |
* "$Id: treasure.c,v 1.21 2001/10/30 02:30:19 michtoen Exp $"; | | * "$Id: treasure.c,v 1.22 2001/11/16 01:34:17 michtoen Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <funcpoint.h> | | #include <funcpoint.h> |
#include <loader.h> | | #include <loader.h> |
| | |
| | |
| | static change_treasure(treasure *t, object *op); /* overrule default values */ |
| | |
/* | | /* |
* Initialize global archtype pointers: | | * Initialize global archtype pointers: |
*/ | | */ |
| | |
LOG(llevError,"Treasure lacks archetype: %s\n",variable); | | LOG(llevError,"Treasure lacks archetype: %s\n",variable); |
} else if (sscanf(cp, "list %s", variable)) | | } else if (sscanf(cp, "list %s", variable)) |
t->name = add_string(variable); | | t->name = add_string(variable); |
| | else if (sscanf(cp, "change_name %s", variable)) |
| | t->change_arch.name = add_string(variable); |
else if(sscanf(cp,"chance %d",&value)) | | else if(sscanf(cp,"chance %d",&value)) |
t->chance=(uint8) value; | | t->chance=(uint8) value; |
else if(sscanf(cp,"nrof %d",&value)) | | else if(sscanf(cp,"nrof %d",&value)) |
| | |
} | | } |
} | | } |
| | |
| | /* if there are change_xxx commands in the treasure, we include the changes |
| | * in the generated object |
| | */ |
| | static change_treasure(treasure *t, object *op) |
| | { |
| | /* CMD: change_name xxxx */ |
| | if(t->change_arch.name) |
| | { |
| | if(op->name) |
| | free_string(op->name); |
| | op->name = add_string(t->change_arch.name); |
| | } |
| | |
| | } |
| | |
void create_all_treasures(treasure *t, object *op, int flag, int difficulty, int tries) { | | void create_all_treasures(treasure *t, object *op, int flag, int difficulty, int tries) { |
object *tmp; | | object *tmp; |
| | |
| | |
if(t->nrof&&tmp->nrof<=1) | | if(t->nrof&&tmp->nrof<=1) |
tmp->nrof = RANDOM()%((int) t->nrof) + 1; | | tmp->nrof = RANDOM()%((int) t->nrof) + 1; |
fix_generated_item (tmp, op, difficulty, t->magic, flag); | | fix_generated_item (tmp, op, difficulty, t->magic, flag); |
| | change_treasure(t, tmp); |
put_treasure (tmp, op, flag); | | put_treasure (tmp, op, flag); |
} | | } |
} | | } |
| | |
if(t->nrof&&tmp->nrof<=1) | | if(t->nrof&&tmp->nrof<=1) |
tmp->nrof = RANDOM()%((int) t->nrof) + 1; | | tmp->nrof = RANDOM()%((int) t->nrof) + 1; |
fix_generated_item (tmp, op, difficulty, t->magic, flag); | | fix_generated_item (tmp, op, difficulty, t->magic, flag); |
| | change_treasure(t, tmp); |
put_treasure (tmp, op, flag); | | put_treasure (tmp, op, flag); |
} | | } |
} | | } |
| | |
case 4: | | case 4: |
case 5: | | case 5: |
case 6: | | case 6: |
set_attr_value(&op->stats, r, bonus + get_attr_value(&op->stats,r)); | | set_attr_value(&op->stats, r, (signed char)(bonus + get_attr_value(&op->stats,r))); |
break; | | break; |
| | |
case 7: | | case 7: |
| | |
| | |
if ( ! (flags & GT_ENVIRONMENT)) | | if ( ! (flags & GT_ENVIRONMENT)) |
fix_flesh_item (op, creator); | | fix_flesh_item (op, creator); |
| | |
} | | } |
| | |
/* | | /* |
| | |
free_string(item->name); | | free_string(item->name); |
item->name=add_string(tmpbuf); | | item->name=add_string(tmpbuf); |
/* weight is FLESH weight/100 * donor */ | | /* weight is FLESH weight/100 * donor */ |
if((item->weight = (float) (item->weight/100.0) * donor->weight)==0) | | if((item->weight = (signed long) (((double)item->weight/(double)100.0) * (double)donor->weight))==0) |
item->weight=1; | | item->weight=1; |
| | |
/* value is multiplied by level of donor */ | | /* value is multiplied by level of donor */ |