Commit Graph

17172 Commits

Author SHA1 Message Date
SHIRAKATA Kentaro
aaac9dc1f7 split making pits on do_earthquake() into a separate function 2024-09-20 01:00:37 +09:00
PatR
5e572d3d5f fix part of github issue #1285 - cursed curses
Issue reported by g-branden-robinson:  vertical status panel ended
up with an extra closing paren on the energy line, and sometimes
popups left some text and/or border to the right of the map.

I haven't been able to reproduce the energy anomaly.  It is possible
that it is dependent on the version of curses.

This fixes the leftover popup traces that the base window catches
(and hangs onto) when there is extra space to the right of the map.
Erasing a popup prior to deleting it suffices to make base window
forget it.

I have a more elaborate fix that covers the space to the right of
the map, when there is some, with an extra window and erases that
window when refreshing the map.  It works but adds a bunch of code
that we can get by without.

Issue #1285 is still open.
2024-09-19 01:41:24 -07:00
Pasi Kallinen
d126ae9a42 Reduce crystal plate mail weight 2024-09-18 21:39:55 +03:00
PatR
1b998a3321 relink_light_sources comment
I remembered some more of the light source problem that led to the
panic() call that was fixed earlier today, but I'm not sure how
accurate this new comment is.  If it is accurate, the changes of
impossible() to panic() that the fix included won't necessarily
catch the old, apparently one-off, problem it describes.
2024-09-17 21:28:10 -07:00
PatR
6b08e7758b fix restore panic: relink_light_sources
Reported directly to devteam:  restoring a save file which was
made while the hero was polymorphed into a light emitting monster
would trigger a panic.

This was caused by an attempt to deal with corrupted save data,
which in turn was caused by attempting to use impossible() in a
situation where the game can't reliably continue.  If bad light
source data was ignored during restore, it would cause trouble
during next save.

Remove the check which was erroneously detecting invalid data
and also change two impossible() calls to panic().
2024-09-17 14:55:01 -07:00
PatR
93ff5e6409 comment thinko/editing typo 2024-09-15 16:55:45 -07:00
PatR
c2d22bfbe6 glob vs hider fix
Caught by 'sanity_check':  hides-under monster hiding under nothing
after the glob it was under coalesced with an adjacent one.  Tricky
to test because dropped, thrown, or kicked globs will always merge
with the one being hidden under.  Needed to kill the type of monster
that drops the type of glob since it gets created on the floor so
is eligible to draw in the existing one.
2024-09-15 16:49:59 -07:00
PatR
b37d0af41e dipping fix
If you used 'm #dip' to skip being asked about dipping into a
fountain, sink, or pool and go directly to being prompted for which
potion to dip something into, formatting for the thing being dipped
was skipped.  If 'verbose' was On, an uninitialized buffer was
inserted into "dip [] into?" for use by getobj().  Could cause a
crash (prior to a commit made earlier today) but if it didn't, it
would only be noticable to players who leave 'force_invmenu' Off.
2024-09-14 16:34:22 -07:00
PatR
5bb4adace0 'tips' fix and enhancement
When 'tips' are enabled, the farlook tip displays some text at the
start of getpos().  But it clobbered the initial prompt, leaving
the screen in an ambiguous state (seemingly a normal map display,
but it is actually waiting for player to move the cursor) after
removing the tip's popup window.

Reissue the prompt.  farlook's short but misleading prompt of
"Pick an object" is changed to "Pick a monster, object or location".
I would normally include a comma before "or" but omitting it makes
the longer text seem slightly less cluttered.

The other tips are all one-line, delivered via pline().  Prefix
all of their messages with "Tip:" (which the farlook one already
uses) as a hint for using OPTIONS=!tips to shut them off.
2024-09-14 12:53:48 -07:00
nhmall
60dc14952d overflow if 'word' arg points to full QBUFSZ buf
This prevents a buffer overflow that was encountered during fuzzing,
but the underlying issue in the caller dodip() is still pending.

That appears to be the result of 'obuf' not being filled with
appropriate content prior to being used at line 2343 in potion.c.
2024-09-14 12:54:34 -04:00
nhw_cron
351a8fa99c This is cron-daily v1-Apr-1-2024. 005guidebook updated: doc/Guidebook.txt 2024-09-14 12:27:55 -04:00
nhmall
2410bd9e8a fix an automatic addition by CVS back in 2002 2024-09-14 11:34:24 -04:00
nhmall
0bf6f1b247 Improve Guidebook *roff formatting and markup
Pull request #1280 from g-branden-robinson

References:
https://github.com/NetHack/NetHack/pull/1280

Closes #1280
2024-09-14 11:26:23 -04:00
nhmall
bf72423fb0 Merge branch 'NetHack-3.7' of https://github.com/g-branden-robinson/NetHack into NetHack-3.7 2024-09-14 11:15:41 -04:00
G. Branden Robinson
d116052796 Build *roff documents with groff warnings enabled.
...some of them, at any rate.  We shut off (1) warnings provoked by Matt
Bishop's "mn" macro package, and (2) warnings spuriously emitted by
groff 1.23 and previous when "-wall" (or "-ww") is specified.

Also update explanatory comments.
2024-09-14 09:58:12 -05:00
nhmall
a2ec46a640 Merge branch 'moverock_core' of https://github.com/argrath/NetHack into NetHack-3.7 2024-09-14 10:25:08 -04:00
nhmall
cbb32ac64a glyph_to_cmap() becomes function instead of macro
Also adds swallow and explosion glyphs to glyph_to_cmap()

References:
https://github.com/NetHack/NetHack/pull/1022 by argrath
https://github.com/NetHack/NetHack/pull/1277 by ars3niy

Closes #1277
Closes #1022
2024-09-14 10:12:09 -04:00
nhmall
04433aead8 Merge branch 'custom-swallow-glyphs' of https://github.com/ars3niy/NetHack into NetHack-3.7 2024-09-14 09:52:18 -04:00
nhmall
bf1af7c471 Merge branch 'NetHack-3.7' of https://github.com/klorpa/NetHack into NetHack-3.7 2024-09-14 09:17:48 -04:00
PatR
933330a0df move saving-grace back behind the curtain
If hero survives a killing blow via saving-grace, report that to
livelog but hide it from player's own #chronicle.

Only reveal whether saving-grace was used up during end-of-game
disclosure.  Omit that during enlightenment unless running in
explore mode (or wizard mode).
2024-09-13 13:31:12 -07:00
nhmall
5091ac3fdd Guidebook.txt update Sept 13, 2024 2024-09-13 13:28:32 -04:00
nhmall
439c2a0352 Guidebook catch-up
S_engrcorr
S_engroom
2024-09-13 13:05:11 -04:00
PatR
b93cfecbaf fix github issue #1252 - current HP > maximum HP
Sanity check failure generated by running the fuzzer, reported
by mkuoppal.  The check discovered that the hero's current hit
points were greater than the maximum.

Comments by elunna pointed out where the problem most likely was,
and this attempts to fix the situation, but without a test case
I can't be sure that the fix works.

Both cases being fixed are for formerly fatal incidents (random
chance that poison is fatal, monster touch of death spell) being
'softened' to heavy HP damage (including reduction of maxHP).

The earlier commit I made (045d608) was done without having seen
the relevant comments.  It didn't fix anything but did attempt
to make finding the problem(s) easier.  It wasn't much help.

Fixes #1252
2024-09-12 12:16:40 -07:00
SHIRAKATA Kentaro
f1626f48ea split moverock_core() into a separate function
... to force a call to moverock_done() at the end.
2024-09-13 02:51:11 +09:00
PatR
fe91590d17 a couple of comments 2024-09-10 23:16:55 -07:00
G. Branden Robinson
e318d21afc doc/tmac.nh (ED): Don't dedent below zero.
This quietens several warnings from GNU troff in the "range" category.

troff: backtrace: './doc/tmac.nh':92: macro 'ED'
troff: backtrace: file './doc/Guidebook.mn':5950
troff:./doc/Guidebook.mn:5950: warning: treating -120u indentation as
zero

Unfortunately, the similar `ed` macro in Bishop's "mn" package
contributes several more.

But with this change (and its forerunners in this series), the NetHack
Guidebook is now warning-free with "-wall -Wtab -Wrange" ("mn" has
problems with tab characters too), even with the increasingly fastidious
syntactical checks of the forthcoming groff 1.24 release.
2024-09-10 06:45:00 -05:00
G. Branden Robinson
cbff67b0d6 doc/tmac.nh: Fix mistaken syntax.
The forthcoming groff 1.24 has a new diagnostic that detects ill-formed
numeric expressions.  It has found one here.

I'm not positive what was intended here, but it may have been an attempt
to force interpretation of the first macro argument as a number.  This
change employs a more idiomatic (but still old-school) technique.

The salient fact is that, in *roff, you can't affix a scaling unit after
a closing parenthesis (or another scaling unit).

In GNU troff the `\B` escape sequence, an extension, permits the testing
of putative numeric expressions for validity.

troff:./doc/Guidebook.mn:268: warning: expected end of line or an
auto-increment argument in register definition request; got character
'v'

See <https://savannah.gnu.org/bugs/?64240>.
2024-09-10 06:45:00 -05:00
G. Branden Robinson
37434a5fa9 doc/Guidebook.mn: Fix bad comment syntax.
These lines were passing a spurious "." argument to the `BR` macro
defined in "doc/tmac.nh".
2024-09-10 06:45:00 -05:00
G. Branden Robinson
6167de1a54 doc/Guidebook.mn: Use different technique.
...to get a block paragraph from the `n` package, instead of
manipulating indentation directly, which can lead to grief.
2024-09-10 06:44:43 -05:00
G. Branden Robinson
ade0c02b20 Make it easier for the Guidebook to find macros.
* doc/Guidebook.mn: Make the Guidebook buildable from the top of the
  source tree, not just inside the "doc" directory.  Try to load its
  "nh" macro package from the current working directory and from "doc".

* doc/tmac.nh: Allocate new register `nH` to the purpose of detecting
  multiple loads, and skip file content if detected.  This is the 1970s
  nroff form of an "#include guard".  groff's "an-ext.tmac" uses the
  same technique for portability.

Also I removed a tab character.  Per the groff Texinfo manual:

     One possibly irritating idiosyncrasy is that tabs should not be
     used to vertically align comments in the source document.  Tab
     characters are not treated as separators between a request name and
     its first argument, nor between arguments.

Here's an example of how one groff macro package works around the
problem.

$ sed -n '402,406p' contrib/mm/m.tmac
.ds LetCN CONFIDENTIAL\"                Confidential default
.ds LetSA To Whom It May Concern:\"     Salutation default
.ds LetAT ATTENTION:\"                  Attention string
.ds LetSJ SUBJECT:\"                    Subject string
.ds LetRN In reference to:\"            Reference string
2024-09-10 06:44:43 -05:00
G. Branden Robinson
1dd11dc916 doc/tmac.n: Fix erroneous lines.
I'm mindful of the license here, but suspect that these lines crept in
after Matt Bishop's time.  Text lines in a macro package can be
insidious because they cause formatting operations to start even in the
absence of an input document.  The forthcoming groff 1.24 has a new
diagnostic to help catch these situations.

The groff Texinfo manual says:

     A '\"' comment on a line by itself is treated as a blank line,
     because after eliminating the comment, that is all that remains.

          Test
          \" comment
          Test
              => Test
              =>
              => Test

     To compensate, it is common to combine the empty request with the
     comment escape sequence as '.\"', causing the input line to be
     ignored.

Fixes:

$ (cd doc && groff -t -M . -mn -mnh Guidebook.mn > /dev/null)
troffrc:./tmac.n:1: text line in startup file
troffrc:./tmac.n:764: text line in startup file
2024-09-10 06:44:43 -05:00
G. Branden Robinson
67d97d1e03 doc/Guidebook.mn: Fix typo in escape sequence.
\F and \f do different things.

Fixes:

$ (cd doc && cat Guidebook.mn | tbl tmac.n - | groff > Guidebook.ps)
troff:<standard input>:3468: error: no font family named 'I' exists
2024-09-10 06:44:43 -05:00
G. Branden Robinson
5d005a3a95 doc/Guidebook.mn: Refactor achievement table.
Use tbl(1); this sort of layout is what it's designed for.  Use text
blocks to enable lengthy achievement descriptions to break across lines.
2024-09-10 06:44:43 -05:00
G. Branden Robinson
2bbefa2e4d doc/Guidebook.mn: Simplify table format.
The 'A' ("alphabetic") and 'N' ("numeric") column classifiers were being
used to little benefit.

Since 'A' was applying to every row of the table, none was more indented
than any other, except via the inclusion of unadjustable, unbreakable
space escape sequences `\ `, which work just as well with column
classifier 'L' ("left").

In fact, even they are unnecessary; regular spaces will do.

tbl(1):
     Ordinarily, a table entry is typeset rigidly.  It is not filled,
     broken, hyphenated, adjusted, or populated with additional inter‐
     sentence space.

...so furthermore convert the escaped spaces to regular ones.

Similarly, 'N' applies several rules to manage alignment of decimal
points.  This table doesn't need them.  Right-alignment of integers is
just as easily achieved with the 'R' ("right") column classifier.
2024-09-10 06:43:14 -05:00
G. Branden Robinson
f886f71d49 doc/Guidebook.mn: Fix table markup nits.
Comment escape sequences inside table entries can wreak havoc.  Use
dummy character instead to visually indicate the deliberate trailing
spaces.  Move the comment explaining why they're there closer to what
they document.  It's okay to have _whole-line_ comments in table data,
because they are on control lines (lines that start with a dot '.').

Also use the dummy character to indicate deliberately empty table cells.
2024-09-10 06:24:03 -05:00
nhmall
bddc26faf6 debug_fuzzer follow-up 2024-09-09 17:40:00 -04:00
nhmall
d852d54e4c debug_fuzzer change
I don't always want to abort() on an impossible() when debug_fuzzing,
especially if the first impossible() encountered isn't related to the
bug I'm in the midst of trying to hunt down.

I often have breakpoints on impossible() anyway, and I'd like a simple
way to avoid the panic() call during a lengthy debug session.

Make iflags.debug_fuzzer an xint8 instead of a boolean.
Call abort() only if iflags.debug_fuzzer is set to 1.

That allows setting iflags.debug_fuzzer to 2 in order to bypass the
abort call, and make use of other breakpoints that have been set
to narrow down a particular issue.
2024-09-09 17:26:53 -04:00
Pasi Kallinen
6f64ed90ed Curses: prevent menu search without menu options
First noticed this when watching someone livestream, and managed
to figure it out from there: The window that pops up when looking
at a pile of objects under you by pressing ':' is marked as a menu,
but has no selectable options.  Curses still allowed you to use the
menu-search command (':') on it.

Prevent the menu search command in windows with no selectable entries.
2024-09-08 20:29:58 +03:00
PatR
3c80aa7e86 comment fix
Dylexic editting.
2024-09-07 11:16:57 -07:00
nhmall
bcdf077d9f avoid any potential hassle with C23 unreachable macro 2024-09-07 11:34:12 -04:00
nhw_cron
cf7af6a201 This is cron-daily v1-Apr-1-2024. 000files updated: Files 2024-09-07 10:57:47 -04:00
nhmall
33652b8288 remove extraneous script file (Windows) 2024-09-07 10:13:04 -04:00
PatR
b9ff8068b4 extending u.usaving_grace
Issue a livelog/#chronicle message if saving-grace saves the hero.
Right now it's classified as conduct for livelog filtering, because
I didn't want to implement a new category (needs update of global.h
and also the template 'sysconf') and conduct felt like the best fit
of the existing classifications.

Report whether saving-grace is available or already used, among
the attributes of magical enlightenment or end-of-game disclosure.

And move the fixes entry for it from the fixes section to the new
features section of fixes3-7-0.txt.

It seems likely that someone will want to turn not using saving-
grace into a tracked conduct.  That seems like overkill to me, not
to mention inflating the N for "N conduct games".
2024-09-06 15:32:26 -07:00
PatR
045d60848b hero health manipulation
I've been investigating issue #1252 (while the fuzzer was running,
sanity_check complained that hero's current health was greater
than maximum health) off and on for three months and haven't found
the cause.

I've checked all the places that lower maximum HP that I've managed
to find, but not spent much time looking for places that raise
current HP.

These changes might provide some more information.  They don't rely
on sanity_check being enabled.

Issue #1252 is still open.
2024-09-06 13:35:00 -07:00
PatR
cf6509dde9 some reformatting (5 of 4)
Take care of most of include/*.h.  I punted on extern.h.

For both src/*.c and include/*.h, I used mismatched checks of
width > 79 to decide which files to look at and then width > 78
to decide which lines to maybe revise, so I didn't look at a bunch
of the files.

I don't plan to go back and do it right.  Shortening lines that are
80 or wider to less than 80 is the significant part.  Otherwise
emacs puts a backslash in column 80 and the rest of the line of text
on the next line of the screen, making things harder to read.
2024-09-06 13:08:07 -07:00
nhkeni
0e1abe0df9 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2024-09-06 15:09:36 -04:00
nhkeni
aa542afe53 Merge branch 'NetHack-3.7' into keni-prefix 2024-09-06 15:07:19 -04:00
Keni
4ed0637590 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2024-09-06 12:05:20 -07:00
Keni
55eed7c19a Ignore lua .dll files. 2024-09-06 12:03:18 -07:00
nhkeni
6b4173688f Documentation cleanup and streamlining. 2024-09-06 12:44:19 -04:00