ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/apply.C
(Generate patch)

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.81 by root, Thu May 3 09:26:45 2007 UTC vs.
Revision 1.82 by root, Mon May 7 03:05:58 2007 UTC

2814 2814
2815 if (!start) 2815 if (!start)
2816 return NULL; 2816 return NULL;
2817 2817
2818 for (tmp = start; tmp; tmp = tmp->below) 2818 for (tmp = start; tmp; tmp = tmp->below)
2819 if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->body_info[loc] && (!tmp->invisible || tmp->type == SKILL)) 2819 if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->slot[loc].info && (!tmp->invisible || tmp->type == SKILL))
2820 return tmp; 2820 return tmp;
2821 2821
2822 return NULL; 2822 return NULL;
2823} 2823}
2824 2824
2880 } 2880 }
2881 2881
2882 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 2882 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
2883 { 2883 {
2884 /* this used up a slot that we need to free */ 2884 /* this used up a slot that we need to free */
2885 if (op->body_info[i]) 2885 if (op->slot[i].info)
2886 { 2886 {
2887 object *last = who->inv; 2887 object *last = who->inv;
2888 2888
2889 /* We do a while loop - may need to remove several items in order 2889 /* We do a while loop - may need to remove several items in order
2890 * to free up enough slots. 2890 * to free up enough slots.
2891 */ 2891 */
2892 while ((who->body_used[i] + op->body_info[i]) < 0) 2892 while ((who->slot[i].used + op->slot[i].info) < 0)
2893 { 2893 {
2894 object *tmp = get_item_from_body_location (last, i); 2894 object *tmp = get_item_from_body_location (last, i);
2895 2895
2896 if (!tmp) 2896 if (!tmp)
2897 { 2897 {
2974 ws = tmp; 2974 ws = tmp;
2975 } 2975 }
2976 2976
2977 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 2977 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
2978 { 2978 {
2979 if (op->body_info[i]) 2979 if (op->slot[i].info)
2980 { 2980 {
2981 /* Item uses more slots than we have */ 2981 /* Item uses more slots than we have */
2982 if (abs (op->body_info[i]) > who->body_info[i]) 2982 if (abs (op->slot[i].info) > who->slot[i].info)
2983 { 2983 {
2984 /* Could return now for efficiency - rest of info below isn't 2984 /* Could return now for efficiency - rest of info below isn't
2985 * really needed. 2985 * really needed.
2986 */ 2986 */
2987 retval |= CAN_APPLY_NEVER; 2987 retval |= CAN_APPLY_NEVER;
2988 } 2988 }
2989 else if ((who->body_used[i] + op->body_info[i]) < 0) 2989 else if ((who->slot[i].used + op->slot[i].info) < 0)
2990 { 2990 {
2991 /* in this case, equipping this would use more free spots than 2991 /* in this case, equipping this would use more free spots than
2992 * we have. 2992 * we have.
2993 */ 2993 */
2994 2994
3000 * does take into the account cases where what is being applied 3000 * does take into the account cases where what is being applied
3001 * may be two handed for example. 3001 * may be two handed for example.
3002 */ 3002 */
3003 if (ws) 3003 if (ws)
3004 { 3004 {
3005 if ((who->body_used[i] - ws->body_info[i] + op->body_info[i]) >= 0) 3005 if ((who->slot[i].used - ws->slot[i].info + op->slot[i].info) >= 0)
3006 { 3006 {
3007 retval |= CAN_APPLY_UNAPPLY; 3007 retval |= CAN_APPLY_UNAPPLY;
3008 continue; 3008 continue;
3009 } 3009 }
3010 } 3010 }
3034 3034
3035 /* This object isn't using up all the slots, so there must 3035 /* This object isn't using up all the slots, so there must
3036 * be another. If so, and it the new item doesn't need all 3036 * be another. If so, and it the new item doesn't need all
3037 * the slots, the player then has a choice. 3037 * the slots, the player then has a choice.
3038 */ 3038 */
3039 if ((who->body_used[i] - tmp1->body_info[i] != who->body_info[i]) 3039 if ((who->slot[i].used - tmp1->slot[i].info != who->slot[i].info)
3040 && abs (op->body_info[i]) < who->body_info[i]) 3040 && abs (op->slot[i].info) < who->slot[i].info)
3041 retval |= CAN_APPLY_UNAPPLY_CHOICE; 3041 retval |= CAN_APPLY_UNAPPLY_CHOICE;
3042 3042
3043 /* Does unequippint 'tmp1' free up enough slots for this to be 3043 /* Does unequippint 'tmp1' free up enough slots for this to be
3044 * equipped? If not, there must be something else to unapply. 3044 * equipped? If not, there must be something else to unapply.
3045 */ 3045 */
3046 if (who->body_used[i] + op->body_info[i] < tmp1->body_info[i]) 3046 if (who->slot[i].used + op->slot[i].info < tmp1->slot[i].info)
3047 retval |= CAN_APPLY_UNAPPLY_MULT; 3047 retval |= CAN_APPLY_UNAPPLY_MULT;
3048 } 3048 }
3049 } /* if not enough free slots */ 3049 } /* if not enough free slots */
3050 } /* if this object uses location i */ 3050 } /* if this object uses location i */
3051 } /* for i -> num_body_locations loop */ 3051 } /* for i -> num_body_locations loop */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines