version 1.2 | | version 1.3 |
---|
| | |
if (op->type == SPECIAL_KEY && sack->slaying && op->slaying) | | if (op->type == SPECIAL_KEY && sack->slaying && op->slaying) |
sprintf (buf, "You don't want put the key into %s.", query_name(sack)); | | sprintf (buf, "You don't want put the key into %s.", query_name(sack)); |
if (sack->weight_limit && sack->carrying + (nrof ? nrof : 1) * | | if (sack->weight_limit && sack->carrying + (nrof ? nrof : 1) * |
op->weight * (100 - sack->stats.Str) / 100 > sack->weight_limit) | | (op->weight + (op->type==CONTAINER?(op->carrying*op->stats.Str):0)) |
| | * (100 - sack->stats.Str) / 100 > sack->weight_limit) |
sprintf (buf, "That won't fit in %s!", query_name(sack)); | | sprintf (buf, "That won't fit in %s!", query_name(sack)); |
if (buf[0]) { | | if (buf[0]) { |
if (pl) | | if (pl) |
| | |
free_object(tmp); | | free_object(tmp); |
return; | | return; |
} | | } |
| | if (nrof==0 || nrof>tmp->nrof) nrof=(tmp->nrof?tmp->nrof:1); |
/* Figure out how much weight this object will add to the player */ | | /* Figure out how much weight this object will add to the player */ |
weight = tmp->weight; | | weight = tmp->weight * nrof; |
if (nrof) weight *=nrof; | | if (tmp->inv) weight += tmp->carrying * (100 - tmp->stats.Str) / 100; |
else if (tmp->nrof) weight *= tmp->nrof; | | |
if (op->type == CONTAINER) weight = weight * (100 - op->stats.Str) / 100; | | |
if ((pl->weight + pl->carrying +weight) > weight_limit[pl->stats.Str]) { | | if ((pl->weight + pl->carrying +weight) > weight_limit[pl->stats.Str]) { |
new_draw_info(NDI_UNIQUE, 0,pl,"That item is too heavy for you to pick up."); | | new_draw_info(NDI_UNIQUE, 0,pl,"That item is too heavy for you to pick up."); |
return; | | return; |
| | |
SET_FLAG(tmp, FLAG_WAS_WIZ); | | SET_FLAG(tmp, FLAG_WAS_WIZ); |
#endif | | #endif |
| | |
if(nrof && nrof != tmp->nrof) { | | if(nrof != tmp->nrof && !(nrof == 1 && tmp->nrof == 0)) { |
object *tmp2 = tmp; | | object *tmp2 = tmp; |
tmp = get_split_ob (tmp, nrof); | | tmp = get_split_ob (tmp, nrof); |
if(!tmp) { | | if(!tmp) { |
| | |
*/ | | */ |
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) |
{ | | { |
object *tmp2; | | object *tmp2, *sack2; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | |
if (sack==tmp) return; /* Can't put an object in itself */ | | if (sack==tmp) return; /* Can't put an object in itself */ |
| | |
* we instead move the contents of that container into the active | | * we instead move the contents of that container into the active |
* container, this is only done if the object has something in it. | | * container, this is only done if the object has something in it. |
*/ | | */ |
| | sack2 = tmp; |
sprintf (buf, "You move the items from %s into ", query_name(tmp)); | | new_draw_info_format(NDI_UNIQUE, 0,op, "You move the items from %s into %s.", |
strcat (buf, query_name(op->container)); | | query_name(tmp), query_name(op->container)); |
strcat (buf, "."); | | |
new_draw_info(NDI_UNIQUE, 0,op, buf); | | |
for (tmp2 = tmp->inv; tmp2; tmp2 = tmp) { | | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp) { |
tmp = tmp2->below; | | tmp = tmp2->below; |
if (sack_can_hold(op, op->container, tmp2,tmp2->nrof)) | | if (sack_can_hold(op, op->container, tmp2,tmp2->nrof)) |
| | |
break; | | break; |
} | | } |
} | | } |
| | esrv_update_item (UPD_WEIGHT, op, sack2); |
return; | | return; |
} | | } |
| | |
| | |
if (tmp->invisible) { | | if (tmp->invisible) { |
/* if the following is the case, it must be in an container. */ | | /* if the following is the case, it must be in an container. */ |
if (tmp->env && tmp->env->type != PLAYER) { | | if (tmp->env && tmp->env->type != PLAYER) { |
/* Just toss the object - probably shouldn't be around | | /* Just toss the object - probably shouldn't be hanging |
* around anyways | | * around anyways |
*/ | | */ |
remove_ob(tmp); | | remove_ob(tmp); |