version 1.81 | | version 1.82 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.81 2006/05/21 19:58:17 akirschbaum Exp $"; | | * "$Id: c_object.c,v 1.82 2006/06/02 08:19:35 akirschbaum Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
char buf[VERY_BIG_BUF]; | | char buf[VERY_BIG_BUF]; |
int itemnumber; | | int itemnumber; |
object *item=NULL; | | object *item=NULL; |
| | object *tmp; |
char *closebrace; | | char *closebrace; |
size_t counter; | | size_t counter; |
| | tag_t tag; |
| | |
if (params) { | | if (params) { |
/* Let's skip white spaces */ | | /* Let's skip white spaces */ |
| | |
/* Coming here, everything is fine... */ | | /* Coming here, everything is fine... */ |
if(!strlen(buf)) { | | if(!strlen(buf)) { |
/* Clear custom name */ | | /* Clear custom name */ |
if(item->custom_name) { | | if(item->custom_name == NULL) { |
| | new_draw_info(NDI_UNIQUE,0,op,"This item has no custom name."); |
| | return 1; |
| | } |
| | |
FREE_AND_CLEAR_STR(item->custom_name); | | FREE_AND_CLEAR_STR(item->custom_name); |
| | |
new_draw_info_format(NDI_UNIQUE, 0, op,"You stop calling your %s with weird names.",query_base_name(item,item->nrof>1?1:0)); | | new_draw_info_format(NDI_UNIQUE, 0, op,"You stop calling your %s with weird names.",query_base_name(item,item->nrof>1?1:0)); |
esrv_update_item(UPD_NAME,op,item); | | |
} else { | | } else { |
new_draw_info(NDI_UNIQUE,0,op,"This item has no custom name."); | | if(item->custom_name != NULL && strcmp(item->custom_name, buf) == 0) { |
| | new_draw_info_format(NDI_UNIQUE, 0, op,"You keep calling your %s %s.",query_base_name(item,item->nrof>1?1:0),buf); |
| | return 1; |
} | | } |
} else { | | |
/* Set custom name */ | | /* Set custom name */ |
FREE_AND_COPY(item->custom_name,buf); | | FREE_AND_COPY(item->custom_name,buf); |
| | |
new_draw_info_format(NDI_UNIQUE, 0, op,"Your %s will now be called %s.",query_base_name(item,item->nrof>1?1:0),buf); | | new_draw_info_format(NDI_UNIQUE, 0, op,"Your %s will now be called %s.",query_base_name(item,item->nrof>1?1:0),buf); |
| | } |
| | |
| | tag = item->count; |
| | tmp = merge_ob(item, NULL); |
| | if (tmp == NULL) { |
| | /* object was not merged */ |
esrv_update_item(UPD_NAME,op,item); | | esrv_update_item(UPD_NAME,op,item); |
| | } else { |
| | /* object was merged into tmp */ |
| | esrv_del_item(op->contr, tag); |
| | esrv_send_item(op, tmp); |
} | | } |
| | |
return 1; | | return 1; |