version 1.74 | | version 1.75 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.74 2005/11/16 08:16:08 mwedel Exp $"; | | * "$Id: c_object.c,v 1.75 2006/01/11 02:03:29 cavesomething Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int command_rename_item(object *op, char *params) | | int command_rename_item(object *op, char *params) |
{ | | { |
char buf[VERY_BIG_BUF]; | | char buf[VERY_BIG_BUF]; |
| | int itemnumber; |
object *item=NULL; | | object *item=NULL; |
char *closebrace; | | char *closebrace; |
size_t counter; | | size_t counter; |
| | |
while(' '==*params) params++; | | while(' '==*params) params++; |
| | |
/* Checking the first part */ | | /* Checking the first part */ |
if ('<'==*params) { | | if (itemnumber = atoi(params)) { |
| | for (item=op->inv; item && ((item->count != itemnumber) || item->invisible); item=item->below); |
| | if (!item) { |
| | new_draw_info(NDI_UNIQUE,0,op,"Tried to rename an invalid item."); |
| | return 1; |
| | } |
| | params = strchr(params, ' '); |
| | if (params) params++; |
| | } |
| | else if ('<'==*params) { |
/* Got old name, let's get it & find appropriate matching item */ | | /* Got old name, let's get it & find appropriate matching item */ |
closebrace=strchr(params,'>'); | | closebrace=strchr(params,'>'); |
if(!closebrace) { | | if(!closebrace) { |