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:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1576 $ $NHDT-Date: 1763708572 2025/11/20 23:02:52 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1578 $ $NHDT-Date: 1764044196 2025/11/24 20:16:36 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -1537,6 +1537,10 @@ travel couldn't find the vibrating square if it was covered by an object or
|
||||
travel would stop one step in front of known vibrating square like other traps
|
||||
fix bug which delayed burden changes due to monster actions (e.g. reverting to
|
||||
natural form due to damage, changing carry capacity) for one turn
|
||||
on arboreal levels (Ranger quest) where STONE terrain is treated as TREE, an
|
||||
object at a tree location would be described as "embedded in stone"
|
||||
an item at an ordinary tree location, whether the level is arboreal or not,
|
||||
would be described as itself with no mention of the tree
|
||||
|
||||
|
||||
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1738638877 2025/02/03 19:14:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1476 $ */
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1764044196 2025/11/24 20:16:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1509 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1657,6 +1657,7 @@ extern struct obj *mk_named_object(int, struct permonst *,
|
||||
coordxy, coordxy,
|
||||
const char *) ;
|
||||
extern struct obj *rnd_treefruit_at(coordxy, coordxy);
|
||||
extern boolean is_treefruit(struct obj *) NONNULLARG1;
|
||||
extern void set_corpsenm(struct obj *, int) NONNULLARG1;
|
||||
extern long rider_revival_time(struct obj *, boolean) NONNULLARG1;
|
||||
extern void start_corpse_timeout(struct obj *) NONNULLARG1;
|
||||
|
||||
14
src/mkobj.c
14
src/mkobj.c
@@ -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)
|
||||
|
||||
10
src/pager.c
10
src/pager.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 pager.c $NHDT-Date: 1737013431 2025/01/15 23:43:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.287 $ */
|
||||
/* NetHack 3.7 pager.c $NHDT-Date: 1764044196 2025/11/24 20:16:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.292 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2018. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -394,11 +394,17 @@ look_at_object(
|
||||
otmp->where = OBJ_FREE; /* object_from_map set it to OBJ_FLOOR */
|
||||
dealloc_obj(otmp), otmp = NULL; /* has no contents */
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
Strcpy(buf, something); /* sanity precaution */
|
||||
}
|
||||
|
||||
if (otmp && otmp->where == OBJ_BURIED)
|
||||
Strcat(buf, " (buried)");
|
||||
/* check TREE before STONE due to level.flags.arboreal */
|
||||
else if (IS_TREE(levl[x][y].typ))
|
||||
/* "dangling": "hanging" could imply that it's growing on this tree */
|
||||
Snprintf(eos(buf), BUFSZ - strlen(buf), " %s in a tree",
|
||||
(otmp && is_treefruit(otmp)) ? "dangling" : "stuck");
|
||||
else if (levl[x][y].typ == STONE || levl[x][y].typ == SCORR)
|
||||
Strcat(buf, " embedded in stone");
|
||||
else if (IS_WALL(levl[x][y].typ) || levl[x][y].typ == SDOOR)
|
||||
|
||||
Reference in New Issue
Block a user