version 1.85 | | version 1.86 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.85 2006/08/12 12:00:31 gros Exp $"; | | * "$Id: c_object.c,v 1.86 2006/08/12 12:23:30 gros Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int command_take (object *op, char *params) | | int command_take (object *op, char *params) |
{ | | { |
object *tmp, *next; | | object *tmp, *next; |
| | int ival; |
| | int missed = 0; |
| | |
if (op->container) | | if (op->container) |
tmp=op->container->inv; | | tmp=op->container->inv; |
| | |
* but that probably will make it more difficult to read, and | | * but that probably will make it more difficult to read, and |
* not make it any more efficient | | * not make it any more efficient |
*/ | | */ |
if (params && item_matched_string(op, tmp, params)) { | | if (params && (ival=item_matched_string(op, tmp, params))>0) { |
| | if ((ival<=2)&&(!can_pick(op,tmp))) |
| | { |
| | if(!QUERY_FLAG(tmp, FLAG_IS_FLOOR))/* don't count floor tiles */ |
| | missed++; |
| | } |
| | else |
pick_up(op, tmp); | | pick_up(op, tmp); |
} | | } |
else if (can_pick(op, tmp) && !params) { | | else if (can_pick(op, tmp) && !params) { |
| | |
} | | } |
if (!tmp) new_draw_info(NDI_UNIQUE, 0,op, "There is nothing to pick up."); | | if (!tmp) new_draw_info(NDI_UNIQUE, 0,op, "There is nothing to pick up."); |
} | | } |
| | if (missed==1) |
| | new_draw_info(NDI_UNIQUE, 0, op, "You were unable to take one of the items."); |
| | else if (missed>1) |
| | new_draw_info_format(NDI_UNIQUE, 0, op, |
| | "You were unable to take %d of the items.",missed); |
return 0; | | return 0; |
} | | } |
| | |