Commit Graph

10056 Commits

Author SHA1 Message Date
PatR
9390a844f0 green dragon/iron golem breath
A poison gas breath attack that hits a wall would leave a 1x1 gas
cloud region at that wall spot.

Not always noticeable due to other spots along the zap path leaving
regions that blocked vision.
2024-09-26 23:29:32 -07:00
PatR
e9a25a0a1c sanity_check: current hero health better than max
Changes to setuhpmax() a couple of days ago to deal with sanity_check
for "current hero health as monster better than maximum" ended up
triggering sanity_check about "current hero health better than maximum"
when gaining experience level(s) while polymorphed.
2024-09-26 23:00:42 -07:00
PatR
01a6e4e1d1 breathless vs breathless()
Avoid having a variable with the same name as a function-like macro
in case the latter eventually gets turned into an actual function.
2024-09-26 22:19:17 -07:00
PatR
02cc7c76e6 add '?' choice after choosing '* for force_invmenu
If the force_invmenu option is On for choosing an inventory item
and the set of likely candidates is only a subset of full inventory,
then "* (list everything)" is an extra menu choice.  If the player
picks that, the menu is reissued showing entire inventory (with the
extra "* (list everyhing)" choice omitted this time).

When that happens, add "? (list likely candidates)" instead, so that
the menu can be toggled back to how it initially was.

If the menu allows choosing anything in inventory (the 'd' command,
for instance), it will already show full inventory and neither '*'
nor '?' gets included as helper choices.
2024-09-26 09:57:31 -07:00
PatR
0dad60e485 fix github issue #1291 - water walking vs lava
Issue reported by ars3niy:  non-fireproof water walking boots are
supposed to be destroyed if worn on lava, but a post-3.6 change
made that only happen if the hero died and left bones.

The boots remained intact if hero was fire resistant or survived
6d6 damage.  Staying intact should only happen if they're fireproof.

This seems to work but each time lava_effects() gets modified it
becomes more fragile.  Having deleted objects stick around doesn't
help with this problem, which is to keep an item which is being
stolen--and whose loss causes the hero to drop into lava--from
being burned up before being transferred to the thief's inventory.

Fixes #1291
2024-09-26 08:10:26 -07:00
nhmall
63294536f6 eliminate gcc 13.2.0 warnings that recently appeared
timeout.c:550:1: warning: no previous prototype for ‘region_dialogue’ [-Wmissing-prototypes]
  550 | region_dialogue(void)
      | ^~~~~~~~~~~~~~~

../win/curses/curswins.c: In function ‘curses_destroy_win’:
../win/curses/curswins.c:202:33: warning: variable ‘dummyht’ set but not used [-Wunused-but-set-variable]
  202 |     int mapwidth = 0, winwidth, dummyht;
      |                                 ^~~~~~~
2024-09-26 09:49:42 -04:00
PatR
f5d889852b hero-as-gremlin enhancements
When hero is poly'd into a gremlin, using #monster at a fountain
location will clone a gremlin pet.  Do the same at a pool location
(might not match the movie but if not, most likely because the
situation never came up).  Also, do the same for #sit at either
fountain or pool.
2024-09-25 01:19:07 -07:00
PatR
2471306112 prayer fix for being in poison gas cloud region
Like stuck-in-wall, there might not be any place to move the hero
in order to escape a poison gas cloud.  That could result in "fix
all troubles" becoming stuck in a loop.  3.6.something fixed the
stuck-in-wall case by temporarily conferring Passes_walls.  Fix the
in-poison-region case by temporarily conferring Magical_breathing.

Not adequately tested...

I don't think that this fixes "#K4252: NH 3.7 Prayer Bug" where the
game hung during a couple out of scores of prayers.  I didn't see
any other fix-trouble cases that seemed likely to remain unfixed
and end up with repair attempts retrying.
2024-09-25 01:01:17 -07:00
PatR
da8ba281a4 more setuhpmax()
Prayer result of fix very low HP.  Tricky because when poly'd,
prayer operates on both u.mhmax and regular u.uhpmax but setuhpmax()
only operates on one of the two depending on Upolyd.
2024-09-25 00:58:43 -07:00
PatR
a3f176c9dc probably fix #K4269 - sanity failure for u.mh \
being greater than u.mhmax

I think this will fix the situation where current HP as a monster
was greater than maximum HP as a monster, triggering a sanity_check
failure.  No promises though.

[poisoned() needs some missing Upolyd handling.]
2024-09-24 13:59:28 -07:00
SHIRAKATA Kentaro
d6890a38fa split "finishi_splitting" into a separate function 2024-09-22 14:54:44 +09:00
PatR
6e32407e12 pauper vs #conduct
Starting as a pauper and executing #conduct during play reported
"you have gone without possessions", which wasn't accurate unless
your inventory remained empty from start until the time #conduct was
examined.  That isn't tracked.  I don't think it needs to be since
staying possessionless from start to finish is not a viable goal
unless you're on a suicide mission.

Change #conduct feedback for pauper to "you are without possessions"
if inventory is currently empty and "you started without possessions"
when it isn't.

Also, report pauper before nudist (which is enabled implicitly when
starting without any equipment).  The other way around struct me as
being a bit strange, although if nudist was specified in addition
to pauper it probably makes sense.
2024-09-21 16:16:10 -07:00
PatR
dd0d050508 article 'a' for Angel names
The recently revised priestname(), which is also used for angels
since they share the " of <deity>" suffix, included a test for
'!strncmp(,"Angel ",6)', assuming it was looking at the beginning
of "Angel of <deity>".  But the " of <deity>" part doesn't get
appended until later, so the test should be '!strcmp(,"Angel")'
without the trailing space.

Noticed by code inspection; I don't have a test case.  Like priests,
Angels are almost always referred to as "_the_ Angel of <deity>" so
the bad "Angel " check normally wouldn't get reached.

Also, fix an unrelated indentation bit in fixes3-7-0.txt.
2024-09-21 15:55:25 -07:00
nhmall
94210886f3 Merge branch 'do_earthquake' of https://github.com/argrath/NetHack into NetHack-3.7 2024-09-21 13:13:14 -04:00
nhmall
43d74522c8 Merge branch 'cannot_push' of https://github.com/argrath/NetHack into NetHack-3.7 2024-09-21 13:11:32 -04:00
PatR
9a0fc62127 pauper legacy
Give a different introduction (the "legacy" text) when starting play
as a pauper.
2024-09-20 22:19:59 -07:00
PatR
7787d83f50 article 'a' for priest names
|You hear an priestess of Issek incant PHOL ENDE WODAN.

using "an" instead of "a" wasn't because the deity name started
with a vowel, it was because the wrong argument was being passed to
just_an() and just_an("") always yields "an" (actually "an ").

I eventually gave up trying to reproduce the message but am fairly
sure that this fixes it.
2024-09-20 13:33:52 -07:00
SHIRAKATA Kentaro
ee137de820 eliminate some gotos on do_earthquake() 2024-09-20 01:00:37 +09:00
SHIRAKATA Kentaro
aaac9dc1f7 split making pits on do_earthquake() into a separate function 2024-09-20 01:00:37 +09: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
SHIRAKATA Kentaro
f98f7d0bba split "cannot_push" on moverock_done() into a separate function 2024-09-16 16:03:20 +09: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
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
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
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
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
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
nhkeni
aa542afe53 Merge branch 'NetHack-3.7' into keni-prefix 2024-09-06 15:07:19 -04:00
PatR
993c3b303f some reformatting (4 of 4) 2024-09-05 16:49:42 -07:00
PatR
cc1066b1ff some reformatting (3 of 4) 2024-09-05 15:55:24 -07:00
PatR
aa043f0ddf some reformatting (2 of 4) 2024-09-05 14:51:21 -07:00
PatR
50412ba53b some reformatting (1 of 4)
I recently realized that I've been editing sources in a terminal
window that was widened in order to fit curses borders for testing
something or other.  That has resulted in some new wide lines in the
source.  There were lots of old ones too.

This updates some source files to try to achieve the goal of 78
characters or less.  As in the past, I've been inconsistent about
lines with 79 characters.  Lines with 80 or more have been wrapped
or shortened (usually by trimming an end of line comment or removing
redundant parantheses, sometimes just by reducing the indentation
of the continuation portion of an already wrapped line).

I eliminated one instance of warning manipulation for non-constant
format string, and simplified stone_luck() where Ken had a silly
comment about the function argument's name.
2024-09-05 13:12:11 -07:00
PatR
74981d9ff2 wand of secret door detection discovery
Since wand of secret door detection now gives feedback even when it
fails to find anything, always discover it.

Some of the other zapnodir() wands had suspect discoveries.
2024-09-05 01:54:17 -07:00
PatR
cd19f84721 boulder pushing comment
Replace wondering whether something is possible with a description of
how it can happen.
2024-09-05 01:14:20 -07:00
PatR
6da05e1508 kicking door as a giant
Another byproduct of testing boulder pushing.  If you kick a closed
door while polymorphed into a giant, always succeed in breaking the
door instead of maybe getting the Wham! or Thwack! failure result.
2024-09-04 13:34:21 -07:00
PatR
447da0948f shopkeeper vs boulder
Noticed when testing boulder pushing into/out of shops yesterday:
a shopkeeper can "mutter incantations" and fracture a boulder in the
shop, transforming it to rocks.  If hero owed shk for the boulder
(happens when it has been further inside the shop and then gets pushed
to the shop's free spot), it would disappear from the shop's bill and
hero would then owe for the resulting rocks (which cost more than the
boulder!).  That seemed confusing, especially since neither Iu nor Ix
would show the rocks (which are on the floor rather than in invent;
the $ command reported the amount owed, but not what the item was).

When such fracturing happens move the boulder from the unpaid section
of the shop bill to the used-up section before creating the rocks,
which are no longer interesting.
2024-09-04 13:22:14 -07:00