horn_of_plenty-to-container #tip

For tipping purposes, a horn of plenty is treated like a container.
But using one as the source container in a container-to-container tip
wasn't supported.  Implement that.

Also, #tip was offering carried bags of tricks as candidate containers
to tip some other carried container into.  Only do that for ones which
aren't known to be bags of tricks (so when type not discovered yet, or
specific bag not seen yet due to blindness).
This commit is contained in:
PatR
2022-09-14 15:54:24 -07:00
parent 970a263d90
commit c2a9343367
4 changed files with 54 additions and 23 deletions

View File

@@ -2547,7 +2547,8 @@ dealloc_obj(struct obj *obj)
int
hornoplenty(
struct obj *horn,
boolean tipping) /* caller emptying entire contents; affects shop mesgs */
boolean tipping, /* caller emptying entire contents; affects shop mesgs */
struct obj *targetbox) /* if non-Null, container to tip into */
{
int objcount = 0;
@@ -2597,6 +2598,14 @@ hornoplenty(
: "Oops! %s to the floor!",
The(aobjnam(obj, "slip")), (char *) 0);
nhUse(obj);
} else if (targetbox) {
add_to_container(targetbox, obj);
/* add to container doesn't update the weight */
targetbox->owt = weight(targetbox);
/* item still in magic horn was weightless; when it's now in
a carried container, hero's encumbrance could change */
if (carried(targetbox))
(void) encumber_msg();
} else {
/* assumes this is taking place at hero's location */
if (!can_reach_floor(TRUE)) {