Repository navigation
Backport NetHack fix: lookat() no longer clobbers bhitpos - #132
lucien-ad-lucem wants to merge 1 commit into
Conversation
lookat() wrote bhitpos, the position of a missile in flight, for every
monster glyph it described, and nothing reachable from it reads the
value. NLE describes every printed glyph when screen_descriptions is
requested, so a missile's animation flushes overwrote its own position
with the squares of monsters drawn, sending it astray and, off the map,
into a place_object() panic. NetHack removed the write in 1dc9f73
("fix #K4201 - bhitpos is clobbered by lookat()"); this applies the
same removal to the bundled 3.6.6 source.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This also fixes #98 (segfault in
I replayed the seed and the 352 recorded actions attached to #98 on NetHack 3.6.6 in two builds that differ only by this change (the action indices were mapped through the current action table). Without it: segfault on the last action, |
NetHack 3.6.6's
lookat()(src/pager.c) writes the globalbhitpos, the position of amissile in flight, for every monster glyph it describes. NetHack removed the write in commit
1dc9f73 ("fix #K4201 - bhitpos is clobbered by lookat()"); nothing reachable from
lookat()reads it. This PR applies the same four-line removal to the bundled source.
NLE reaches
lookat()fromrl_print_glyph()viado_screen_description()wheneverscreen_descriptionsis requested, so every screen flush describes every monster drawn.Example: an unseen monster throws a boulder on a turn when visible monsters have moved. The
missile animation flushes the screen, the moved monsters are drawn, and each overwrites
bhitposwith its own square. The boulder continues from the last monster drawn and lands atthe wrong place; when that square is off the map,
place_object()panics and the processaborts with SIGABRT.
🤖 Generated with Claude Code