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

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.51 by root, Sat May 12 16:06:42 2007 UTC vs.
Revision 1.52 by root, Sat May 12 20:21:54 2007 UTC

58 * only unapply applied, or apply unapplied objects 58 * only unapply applied, or apply unapplied objects
59 **/ 59 **/
60static object * 60static object *
61find_best_apply_object_match (object *pl, const char *params, enum apply_flag aflag) 61find_best_apply_object_match (object *pl, const char *params, enum apply_flag aflag)
62{ 62{
63 object *tmp, *best = NULL; 63 object *best = 0;
64 int match_val = 0, tmpmatch; 64 int match_val = 0;
65 65
66 for (tmp = pl->inv; tmp; tmp = tmp->below) 66 for (object *tmp = pl->inv; tmp; tmp = tmp->below)
67 { 67 {
68 if (tmp->invisible) 68 if (tmp->invisible)
69 continue; 69 continue;
70
70 if ((tmpmatch = item_matched_string (pl, tmp, params)) > match_val) 71 int tmpmatch = item_matched_string (pl, tmp, params);
72
73 if (tmpmatch > match_val)
71 { 74 {
72 if ((aflag == AP_APPLY) && (QUERY_FLAG (tmp, FLAG_APPLIED))) 75 if ((aflag == AP_APPLY) && (QUERY_FLAG (tmp, FLAG_APPLIED)))
73 continue; 76 continue;
77
74 if ((aflag == AP_UNAPPLY) && (!QUERY_FLAG (tmp, FLAG_APPLIED))) 78 if ((aflag == AP_UNAPPLY) && (!QUERY_FLAG (tmp, FLAG_APPLIED)))
75 continue; 79 continue;
80
76 match_val = tmpmatch; 81 match_val = tmpmatch;
77 best = tmp; 82 best = tmp;
78 } 83 }
79 } 84 }
85
80 return best; 86 return best;
81} 87}
82 88
83/** 89/**
84 * Shortcut to find_best_apply_object_match(pl, params, AF_NULL); 90 * Shortcut to find_best_apply_object_match(pl, params, AF_NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines