version 1.87 | | version 1.88 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.87 2006/08/12 18:59:59 gros Exp $"; | | * "$Id: c_object.c,v 1.88 2006/09/09 20:31:31 qal21 Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
* nrof objects is tried to dropped. | | * nrof objects is tried to dropped. |
* This is used when dropping objects onto the floor. | | * This is used when dropping objects onto the floor. |
*/ | | */ |
void drop_object (object *op, object *tmp, uint32 nrof) | | object *drop_object (object *op, object *tmp, uint32 nrof) |
{ | | { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
object *floor; | | object *floor; |
| | |
/* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */ | | /* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */ |
new_draw_info(NDI_UNIQUE, 0,op, "This item can't be dropped."); | | new_draw_info(NDI_UNIQUE, 0,op, "This item can't be dropped."); |
#endif | | #endif |
return; | | return NULL; |
} | | } |
| | |
if(QUERY_FLAG(tmp, FLAG_APPLIED)) { | | if(QUERY_FLAG(tmp, FLAG_APPLIED)) { |
if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) | | if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) |
return; /* can't unapply it */ | | return NULL; /* can't unapply it */ |
} | | } |
| | |
/* We are only dropping some of the items. We split the current objec | | /* We are only dropping some of the items. We split the current objec |
| | |
tmp = get_split_ob (tmp, nrof); | | tmp = get_split_ob (tmp, nrof); |
if(!tmp) { | | if(!tmp) { |
new_draw_info(NDI_UNIQUE, 0,op, errmsg); | | new_draw_info(NDI_UNIQUE, 0,op, errmsg); |
return; | | return NULL; |
} | | } |
/* Tell a client what happened rest of objects. tmp2 is now the | | /* Tell a client what happened rest of objects. tmp2 is now the |
* original object | | * original object |
| | |
| | |
/* Lauwenmark: Handle for plugin drop event */ | | /* Lauwenmark: Handle for plugin drop event */ |
if (execute_event(tmp, EVENT_DROP,op,NULL,NULL,SCRIPT_FIX_ALL)!= 0) | | if (execute_event(tmp, EVENT_DROP,op,NULL,NULL,SCRIPT_FIX_ALL)!= 0) |
return; | | return NULL; |
| | |
if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) { | | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) { |
sprintf(buf,"You drop the %s.", query_name(tmp)); | | sprintf(buf,"You drop the %s.", query_name(tmp)); |
| | |
esrv_del_item (op->contr, tmp->count); | | esrv_del_item (op->contr, tmp->count); |
free_object(tmp); | | free_object(tmp); |
fix_player(op); | | fix_player(op); |
return; | | return NULL; |
} | | } |
| | |
/* If SAVE_INTERVAL is commented out, we never want to save | | /* If SAVE_INTERVAL is commented out, we never want to save |
| | |
/* Need to update the weight for the player */ | | /* Need to update the weight for the player */ |
esrv_send_item (op, op); | | esrv_send_item (op, op); |
} | | } |
| | return tmp; |
} | | } |
| | |
void drop(object *op, object *tmp) | | void drop(object *op, object *tmp) |