fix issue #1462 - objects embedded in trees

Issue reported by chappg:  on arboreal levels, when an object was
located at a stone location treated as a tree location, examining
the object would report it as embedded in stone.

The Ranger quest has arboreal levels where STONE becomes TREE, and
items that would become embedded in stone will be in trees instead.
(Sometimes kicking a tree would drop fruit onto an adjacent tree,
effectively embedding it.  For testing, it's easier just to poly
into a xorn, walk onto the tree spot, and drop something.)  The item
description code for farlook and quicklook wasn't checking for that.

The fix also corrects another bug:  an item located at a normal tree
location would just be described as itself with no mention of the
tree at all.  Attempting to walk onto it would report the terrain
and not let you move there (assuming not in xorn form), like trying
to walk into a wall.

Fixes #1462
This commit is contained in:
PatR
2025-11-24 12:37:08 -08:00
parent 88256d895a
commit 7b5d7d7ae6
4 changed files with 28 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mkobj.c $NHDT-Date: 1737528890 2025/01/21 22:54:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.315 $ */
/* NetHack 3.7 mkobj.c $NHDT-Date: 1764044196 2025/11/24 20:16:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.326 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1979,6 +1979,18 @@ rnd_treefruit_at(coordxy x, coordxy y)
return mksobj_at(ROLL_FROM(treefruits), x, y, TRUE, FALSE);
}
/* for describing objects embedded in trees */
boolean
is_treefruit(struct obj *otmp)
{
int fruitidx;
for (fruitidx = 0; fruitidx < SIZE(treefruits); ++fruitidx)
if (treefruits[fruitidx] == otmp->otyp)
return TRUE;
return FALSE;
}
/* create a stack of N gold pieces; never returns Null */
struct obj *
mkgold(long amount, coordxy x, coordxy y)