version 1.6 | | version 1.7 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.6 1999/08/18 20:43:54 damn Exp $"; | | * "$Id: apply.c,v 1.7 1999/09/17 18:39:56 damn Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int prepare_weapon(object *op, object *improver, object *weapon) | | int prepare_weapon(object *op, object *improver, object *weapon) |
{ | | { |
int sacrifice_count; | | int sacrifice_count; |
char *tmp; | | char buf[MAX_BUF]; |
| | |
if (weapon->level!=0) { | | if (weapon->level!=0) { |
new_draw_info(NDI_UNIQUE,0,op,"Weapon already prepared."); | | new_draw_info(NDI_UNIQUE,0,op,"Weapon already prepared."); |
| | |
new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.", | | new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.", |
weapon->name,sacrifice_count); | | weapon->name,sacrifice_count); |
| | |
tmp = (char *) malloc(strlen(weapon->name)+strlen(op->name) + 4); | | sprintf(buf,"%s's %s",op->name,weapon->name); |
sprintf(tmp,"%s's %s",op->name,weapon->name); | | weapon->name=add_string(buf); |
weapon->name=tmp; /* this seems to be wrong -Tero */ | | |
weapon->nrof=0; /* prevents preparing n weapons in the same | | weapon->nrof=0; /* prevents preparing n weapons in the same |
slot at once! */ | | slot at once! */ |
decrease_ob(improver); | | decrease_ob(improver); |
| | |
armour->magic++; | | armour->magic++; |
armour->armour+=addarm; | | armour->armour+=addarm; |
armour->weight+=armour->weight*0.05; | | armour->weight+=armour->weight*0.05; |
| | if (op->type == PLAYER) { |
| | esrv_send_item(op, armour); |
| | if(QUERY_FLAG(armour, FLAG_APPLIED)) |
| | fix_player(op); |
| | } |
decrease_ob(improver); | | decrease_ob(improver); |
return 1; | | return 1; |
} else { | | } else { |
| | |
*/ | | */ |
| | |
void apply_lighter(object *who, object *lighter) { | | void apply_lighter(object *who, object *lighter) { |
object *item = who->inv; | | object *item; |
int count,nrof; | | int count,nrof; |
char item_name[MAX_BUF]; | | char item_name[MAX_BUF]; |
| | |
item=find_marked_object(who); | | item=find_marked_object(who); |
if(item) { | | if(item) { |
| | if(lighter->last_eat && lighter->stats.food) { /* lighter gets used up */ |
| | /* Split multiple lighters if they're being used up. Otherwise * |
| | * one charge from each would be used up. --DAMN */ |
| | if(lighter->nrof > 1) { |
| | object *oneLighter = get_object(); |
| | copy_object(lighter, oneLighter); |
| | lighter->nrof -= 1; |
| | oneLighter->nrof = 1; |
| | oneLighter->stats.food--; |
| | esrv_send_item(who, lighter); |
| | oneLighter=insert_ob_in_ob(oneLighter, who); |
| | esrv_send_item(who, oneLighter); |
| | } else { |
| | lighter->stats.food--; |
| | } |
| | |
| | } else if(lighter->last_eat) { /* no charges left in lighter */ |
| | new_draw_info_format(NDI_UNIQUE, 0,who, |
| | "You attempt to light the %s with a used up %s.", |
| | item->name, lighter->name); |
| | return; |
| | } |
/* Perhaps we should split what we are trying to light on fire? | | /* Perhaps we should split what we are trying to light on fire? |
* I can't see many times when you would want to light multiple | | * I can't see many times when you would want to light multiple |
* objects at once. | | * objects at once. |
*/ | | */ |
if(lighter->last_eat && lighter->stats.food) /* lighter is used up */ | | |
lighter->stats.food--; | | |
else if(lighter->last_eat) { /* no charges left in lighter */ | | |
new_draw_info_format(NDI_UNIQUE, 0,who,"You attempt to light the %s with the %s and nothing happens.", item->name, lighter->name); | | |
return; | | |
} | | |
nrof=item->nrof; | | nrof=item->nrof; |
count=item->count; | | count=item->count; |
/* If the item is destroyed, we don't have a valid pointer to the | | /* If the item is destroyed, we don't have a valid pointer to the |