version 1.77 | | version 1.78 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.77 2006/02/07 07:54:46 mwedel Exp $"; | | * "$Id: c_object.c,v 1.78 2006/03/14 15:25:24 ryo_saeba Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
last->ob=(NEW);\ | | last->ob=(NEW);\ |
last->id=(COUNT); | | last->id=(COUNT); |
| | |
/* Search the inventory of 'pl' for what matches best with params. | | /** |
| | * Search the inventory of 'pl' for what matches best with params. |
* we use item_matched_string above - this gives us consistent behaviour | | * we use item_matched_string above - this gives us consistent behaviour |
* between many commands. Return the best match, or NULL if no match. | | * between many commands. Return the best match, or NULL if no match. |
*/ | | * aflag is used with apply -u , and apply -a to |
object *find_best_object_match(object *pl, const char *params) | | |
{ | | |
object *tmp, *best=NULL; | | |
int match_val=0,tmpmatch; | | |
| | |
for (tmp=pl->inv; tmp; tmp=tmp->below) { | | |
if (tmp->invisible) continue; | | |
if ((tmpmatch=item_matched_string(pl, tmp, params))>match_val) { | | |
match_val=tmpmatch; | | |
best=tmp; | | |
} | | |
} | | |
return best; | | |
} | | |
/* Simlilar to find_best_object_match , but accepts an | | |
* additional parameter for apply -u , and apply -a to | | |
* only unapply applied , or apply unapplied objects | | * only unapply applied , or apply unapplied objects |
*/ | | **/ |
static object *find_best_apply_object_match(object *pl, char *params, enum apply_flag aflag) | | static object *find_best_apply_object_match(object *pl, const char *params, enum apply_flag aflag) |
{ | | { |
object *tmp, *best=NULL; | | object *tmp, *best=NULL; |
int match_val=0,tmpmatch; | | int match_val=0,tmpmatch; |
| | |
return best; | | return best; |
} | | } |
| | |
| | /** |
| | * Shortcut to find_best_apply_object_match(pl, params, AF_NULL); |
| | **/ |
| | object *find_best_object_match(object *pl, const char *params) |
| | { |
| | return find_best_apply_object_match(pl, params, AP_NULL); |
| | } |
| | |
/* | | /* |
* Notes about item creation: | | * Notes about item creation: |
* 1) It is similar in syntax to the dm create command. | | * 1) It is similar in syntax to the dm create command. |