version 1.73 | | version 1.74 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.73 2002/12/21 08:02:33 mwedel Exp $"; | | * "$Id: apply.c,v 1.74 2003/01/07 09:39:15 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
case HORN: | | case HORN: |
case SKILL: | | case SKILL: |
case BOW: | | case BOW: |
| | case LAMP: |
if (tmp->env != op) | | if (tmp->env != op) |
return 2; /* not in inventory */ | | return 2; /* not in inventory */ |
(void) apply_special (op, tmp, aflag); | | (void) apply_special (op, tmp, aflag); |
| | |
*/ | | */ |
static int unapply_special (object *who, object *op, int aflags) | | static int unapply_special (object *who, object *op, int aflags) |
{ | | { |
| | object *tmp2; |
| | |
CLEAR_FLAG(op, FLAG_APPLIED); | | CLEAR_FLAG(op, FLAG_APPLIED); |
switch(op->type) { | | switch(op->type) { |
case WEAPON: | | case WEAPON: |
| | |
new_draw_info_format(NDI_UNIQUE, 0, who, "You unwear %s.",query_name(op)); | | new_draw_info_format(NDI_UNIQUE, 0, who, "You unwear %s.",query_name(op)); |
(void) change_abil (who,op); | | (void) change_abil (who,op); |
break; | | break; |
| | case LAMP: |
| | new_draw_info_format(NDI_UNIQUE, 0, who, "You turn off your %s.", |
| | op->name); |
| | tmp2 = arch_to_object(op->other_arch); |
| | tmp2->x = op->x; |
| | tmp2->y = op->y; |
| | tmp2->map = op->map; |
| | tmp2->below = op->below; |
| | tmp2->above = op->above; |
| | tmp2->stats.food = op->stats.food; |
| | CLEAR_FLAG(tmp2, FLAG_APPLIED); |
| | if (who->type == PLAYER) |
| | esrv_del_item(who->contr, (tag_t)op->count); |
| | remove_ob(op); |
| | free_object(op); |
| | insert_ob_in_ob(tmp2, who); |
| | fix_player(who); |
| | if (QUERY_FLAG(op, FLAG_CURSED) || QUERY_FLAG(op, FLAG_DAMNED)) { |
| | if (who->type == PLAYER) { |
| | new_draw_info(NDI_UNIQUE, 0,who, "Oops, it feels deadly cold!"); |
| | SET_FLAG(tmp2, FLAG_KNOWN_CURSED); |
| | } |
| | } |
| | if(who->type==PLAYER) |
| | esrv_send_item(who, tmp2); |
| | return 1; /* otherwise, an attempt to drop causes problems */ |
| | break; |
case BOW: | | case BOW: |
case WAND: | | case WAND: |
case ROD: | | case ROD: |
| | |
int apply_special (object *who, object *op, int aflags) | | int apply_special (object *who, object *op, int aflags) |
{ | | { |
int basic_flag = aflags & AP_BASIC_FLAGS; | | int basic_flag = aflags & AP_BASIC_FLAGS; |
object *tmp; | | object *tmp, *tmp2; |
int i; | | int i; |
| | |
if(who==NULL) { | | if(who==NULL) { |
| | |
new_draw_info_format(NDI_UNIQUE, 0, who, "You wear %s.",query_name(op)); | | new_draw_info_format(NDI_UNIQUE, 0, who, "You wear %s.",query_name(op)); |
(void) change_abil (who,op); | | (void) change_abil (who,op); |
break; | | break; |
| | case LAMP: |
| | if (op->stats.food < 1) { |
| | new_draw_info_format(NDI_UNIQUE, 0, who, "Your %s is out of" |
| | " fuel!", op->name); |
| | return 1; |
| | } |
| | new_draw_info_format(NDI_UNIQUE, 0, who, "You turn on your %s.", |
| | op->name); |
| | tmp2 = arch_to_object(op->other_arch); |
| | tmp2->x = op->x; |
| | tmp2->y = op->y; |
| | tmp2->map = op->map; |
| | tmp2->below = op->below; |
| | tmp2->above = op->above; |
| | tmp2->stats.food = op->stats.food; |
| | SET_FLAG(tmp2, FLAG_APPLIED); |
| | if (tmp == NULL) { |
| | if (who->type == PLAYER) |
| | esrv_del_item(who->contr, (tag_t)op->count); |
| | remove_ob(op); |
| | free_object(op); |
| | } else { |
| | if (who->type == PLAYER) |
| | esrv_del_item(who->contr, (tag_t)tmp->count); |
| | remove_ob(tmp); |
| | free_object(tmp); |
| | } |
| | insert_ob_in_ob(tmp2, who); |
| | fix_player(who); |
| | if (QUERY_FLAG(op, FLAG_CURSED) || QUERY_FLAG(op, FLAG_DAMNED)) { |
| | if (who->type == PLAYER) { |
| | new_draw_info(NDI_UNIQUE, 0,who, "Oops, it feels deadly cold!"); |
| | SET_FLAG(tmp2, FLAG_KNOWN_CURSED); |
| | } |
| | } |
| | if(who->type==PLAYER) |
| | esrv_send_item(who, tmp2); |
| | return 0; |
| | break; |
/* this part is needed for skill-tools */ | | /* this part is needed for skill-tools */ |
case SKILL: | | case SKILL: |
if (who->chosen_skill) { | | if (who->chosen_skill) { |