version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.5 2000/05/26 09:50:49 jec Exp $"; | | * "$Id: c_object.c,v 1.6 2000/06/08 16:08:41 jec Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
if(nrof != tmp->nrof && !(nrof == 1 && tmp->nrof == 0)) { | | if(nrof != tmp->nrof && !(nrof == 1 && tmp->nrof == 0)) { |
object *tmp2 = tmp; | | object *tmp2 = tmp; |
| | tag_t tmp2_tag = tmp2->count; |
tmp = get_split_ob (tmp, nrof); | | tmp = get_split_ob (tmp, nrof); |
if(!tmp) { | | if(!tmp) { |
new_draw_info(NDI_UNIQUE, 0,pl, errmsg); | | new_draw_info(NDI_UNIQUE, 0,pl, errmsg); |
| | |
} | | } |
/* Tell a client what happened rest of objects */ | | /* Tell a client what happened rest of objects */ |
if (pl->type == PLAYER) { | | if (pl->type == PLAYER) { |
if (QUERY_FLAG(tmp2, FLAG_REMOVED)) | | if (was_destroyed (tmp2, tmp2_tag)) |
esrv_del_item (pl->contr, tmp2->count); | | esrv_del_item (pl->contr, tmp2_tag); |
else | | else |
esrv_send_item (pl, tmp2); | | esrv_send_item (pl, tmp2); |
} | | } |
| | |
*/ | | */ |
void put_object_in_sack (object *op, object *sack, object *tmp, long nrof) | | void put_object_in_sack (object *op, object *sack, object *tmp, long nrof) |
{ | | { |
| | tag_t tmp_tag, tmp2_tag; |
object *tmp2, *sack2; | | object *tmp2, *sack2; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | |
| | |
/* we want to put some portion of the item into the container */ | | /* we want to put some portion of the item into the container */ |
if (nrof && tmp->nrof != nrof) { | | if (nrof && tmp->nrof != nrof) { |
object *tmp2 = tmp; | | object *tmp2 = tmp; |
| | tmp2_tag = tmp2->count; |
tmp = get_split_ob (tmp, nrof); | | tmp = get_split_ob (tmp, nrof); |
| | |
if(!tmp) { | | if(!tmp) { |
| | |
return; | | return; |
} | | } |
/* Tell a client what happened other objects */ | | /* Tell a client what happened other objects */ |
if (QUERY_FLAG(tmp2, FLAG_FREED)) | | if (was_destroyed (tmp2, tmp2_tag)) |
esrv_del_item (op->contr, tmp2->count); | | esrv_del_item (op->contr, tmp2_tag); |
else /* this can proably be replaced with an update */ | | else /* this can proably be replaced with an update */ |
esrv_send_item (op, tmp2); | | esrv_send_item (op, tmp2); |
} else | | } else |
| | |
sprintf(buf, "You put %s in ", query_name(tmp)); | | sprintf(buf, "You put %s in ", query_name(tmp)); |
strcat (buf, query_name(sack)); | | strcat (buf, query_name(sack)); |
strcat (buf, "."); | | strcat (buf, "."); |
| | tmp_tag = tmp->count; |
tmp2 = insert_ob_in_ob(tmp, sack); | | tmp2 = insert_ob_in_ob(tmp, sack); |
new_draw_info(NDI_UNIQUE, 0,op,buf); | | new_draw_info(NDI_UNIQUE, 0,op,buf); |
fix_player(op); /* This is overkill, fix_player() is called somewhere */ | | fix_player(op); /* This is overkill, fix_player() is called somewhere */ |
| | |
* delete the original. | | * delete the original. |
*/ | | */ |
if (tmp2 != tmp) | | if (tmp2 != tmp) |
esrv_del_item (op->contr, tmp->count); | | esrv_del_item (op->contr, tmp_tag); |
| | |
esrv_send_item (op, tmp2); | | esrv_send_item (op, tmp2); |
/* update the sacks and players weight */ | | /* update the sacks and players weight */ |
| | |
*/ | | */ |
if(nrof && tmp->nrof != nrof) { | | if(nrof && tmp->nrof != nrof) { |
object *tmp2 = tmp; | | object *tmp2 = tmp; |
| | tag_t tmp2_tag = tmp2->count; |
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); |
| | |
/* 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 |
*/ | | */ |
if (QUERY_FLAG(tmp2, FLAG_FREED)) | | if (was_destroyed (tmp2, tmp2_tag)) |
esrv_del_item (op->contr, tmp2->count); | | esrv_del_item (op->contr, tmp2_tag); |
else | | else |
esrv_send_item (op, tmp2); | | esrv_send_item (op, tmp2); |
} else | | } else |