1 | /* |
1 | /* |
2 | * static char *rcsid_apply_c = |
2 | * static char *rcsid_apply_c = |
3 | * "$Id: apply.C,v 1.11 2006/08/27 15:24:22 root Exp $"; |
3 | * "$Id: apply.C,v 1.12 2006/08/29 05:03:55 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
… | |
… | |
2545 | } else { |
2545 | } else { |
2546 | return 0; /* monsters just skip unpaid items */ |
2546 | return 0; /* monsters just skip unpaid items */ |
2547 | } |
2547 | } |
2548 | } |
2548 | } |
2549 | |
2549 | |
2550 | |
|
|
2551 | if (INVOKE_OBJECT (APPLY, tmp, ARG_OBJECT (op))) |
2550 | if (INVOKE_OBJECT (APPLY, tmp, ARG_OBJECT (op))) |
2552 | return RESULT_INT (0); |
2551 | return RESULT_INT (0); |
2553 | |
2552 | |
2554 | switch (tmp->type) { |
2553 | switch (tmp->type) { |
2555 | |
2554 | |
… | |
… | |
2850 | * Break this out of apply_special - this is just done |
2849 | * Break this out of apply_special - this is just done |
2851 | * to keep the size of apply_special to a more managable size. |
2850 | * to keep the size of apply_special to a more managable size. |
2852 | */ |
2851 | */ |
2853 | static int unapply_special (object *who, object *op, int aflags) |
2852 | static int unapply_special (object *who, object *op, int aflags) |
2854 | { |
2853 | { |
|
|
2854 | if (INVOKE_OBJECT (BE_UNREADY, op, ARG_OBJECT (who), ARG_INT (aflags)) |
|
|
2855 | || INVOKE_OBJECT (UNREADY, who, ARG_OBJECT (op), ARG_INT (aflags))) |
|
|
2856 | return RESULT_INT (0); |
|
|
2857 | |
2855 | object *tmp2; |
2858 | object *tmp2; |
2856 | |
2859 | |
2857 | CLEAR_FLAG(op, FLAG_APPLIED); |
2860 | CLEAR_FLAG(op, FLAG_APPLIED); |
2858 | switch(op->type) { |
2861 | switch(op->type) { |
2859 | case WEAPON: |
2862 | case WEAPON: |
2860 | new_draw_info_format(NDI_UNIQUE, 0, who, "You unwield %s.",query_name(op)); |
2863 | new_draw_info_format(NDI_UNIQUE, 0, who, "You unwield %s.",query_name(op)); |
2861 | |
2864 | |
2862 | (void) change_abil (who,op); |
2865 | (void) change_abil (who,op); |
2863 | if(QUERY_FLAG(who,FLAG_READY_WEAPON)) |
2866 | if(QUERY_FLAG(who,FLAG_READY_WEAPON)) |
2864 | CLEAR_FLAG(who,FLAG_READY_WEAPON); |
2867 | CLEAR_FLAG(who,FLAG_READY_WEAPON); |
2865 | /* GROS: update the current_weapon_script field (used with script_attack for weapons) */ |
|
|
2866 | who->current_weapon_script = NULL; |
|
|
2867 | who->current_weapon = NULL; |
|
|
2868 | clear_skill(who); |
2868 | clear_skill(who); |
2869 | break; |
2869 | break; |
2870 | |
2870 | |
2871 | case SKILL: /* allows objects to impart skills */ |
2871 | case SKILL: /* allows objects to impart skills */ |
2872 | case SKILL_TOOL: |
2872 | case SKILL_TOOL: |
… | |
… | |
3107 | * See include/define.h for detailed description of the meaning of |
3107 | * See include/define.h for detailed description of the meaning of |
3108 | * these return values. |
3108 | * these return values. |
3109 | */ |
3109 | */ |
3110 | int can_apply_object(object *who, object *op) |
3110 | int can_apply_object(object *who, object *op) |
3111 | { |
3111 | { |
|
|
3112 | if (INVOKE_OBJECT (CAN_BE_APPLIED, op, ARG_OBJECT (who)) |
|
|
3113 | || INVOKE_OBJECT (CAN_APPLY, who, ARG_OBJECT (op))) |
|
|
3114 | return RESULT_INT (0); |
|
|
3115 | |
3112 | int i, retval=0; |
3116 | int i, retval=0; |
3113 | object *tmp=NULL, *ws=NULL; |
3117 | object *tmp=NULL, *ws=NULL; |
3114 | |
3118 | |
3115 | /* Players have 2 'arm's, so they could in theory equip 2 shields or |
3119 | /* Players have 2 'arm's, so they could in theory equip 2 shields or |
3116 | * 2 weapons, but we don't want to let them do that. So if they are |
3120 | * 2 weapons, but we don't want to let them do that. So if they are |
… | |
… | |
3333 | |
3337 | |
3334 | if(op->nrof > 1) |
3338 | if(op->nrof > 1) |
3335 | tmp = get_split_ob(op,op->nrof - 1); |
3339 | tmp = get_split_ob(op,op->nrof - 1); |
3336 | else |
3340 | else |
3337 | tmp = NULL; |
3341 | tmp = NULL; |
|
|
3342 | |
|
|
3343 | if (INVOKE_OBJECT (BE_READY, op, ARG_OBJECT (who)) |
|
|
3344 | || INVOKE_OBJECT (READY, who, ARG_OBJECT (op))) |
|
|
3345 | return RESULT_INT (0); |
3338 | |
3346 | |
3339 | switch(op->type) { |
3347 | switch(op->type) { |
3340 | case WEAPON: |
3348 | case WEAPON: |
3341 | if (!check_weapon_power(who, op->last_eat)) { |
3349 | if (!check_weapon_power(who, op->last_eat)) { |
3342 | new_draw_info(NDI_UNIQUE, 0,who, |
3350 | new_draw_info(NDI_UNIQUE, 0,who, |