Commit Graph

17147 Commits

Author SHA1 Message Date
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
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
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
PatR
bd10bf36ec address #K4246 - pushing shop boulder out of shop
The report is for 3.6.7:  pushing a boulder into a general store adds
it to shop's inventory, but pushing it back out lets player remove it
for free.  3.7 has already fixed this; update its comments though.
2024-09-04 03:00:57 -07:00
PatR
0752422fc0 pull request #1272 - unify moverock()
Pull request from argrath:  change a couple of places in moverock()
to use moverock_done() and return early rather than use break to fall
to the end.

Closes #1272
2024-09-03 23:51:38 -07:00
SHIRAKATA Kentaro
7bb1d4a827 unify moverock() to "early return" style
... to prepare further refactorings.
2024-09-03 23:46:21 -07:00
nhmall
9a09bcdfc9 remove extraneous change from pr 2024-09-03 12:22:37 -04:00
Peter de Vroomen
fd3b3cfcf9 Fix project for Macos builds with Xcode. Builds for MacOs Sequoia (15) and Xcode 16 beta 3. 2024-09-03 12:18:10 -04:00
PatR
ceec9fda44 fix github issue #1278 - spellbook discovery
Issue reported by ars3niy:  having a pauper wizard #enhance bare-handed
fighting to basic caused the hero to learn all level 1 spellbooks.

Spellbook discovery for wizards when advancing skills is intentional,
to replace the old Luck-based chance of writing unknown books with
magic markers.  (The Luck bias for wizards still applies for scrolls.)

Discovering spellbooks when advancing non-spell skills does feel wrong.
Change it to only happen when advancing spell skills.

This isn't pauper-specific, it's just a lot more noticeable in that
state.

There may be better ways to cope with this, but for the time being I'm
marking the issue 'fixed'.

Fixes #1278
2024-09-03 00:05:29 -07:00
Doktor L
52346c8248 Add swallow and explosion glyphs to glyph_to_cmap
This makes custom S_sw_tc etc. from Enhanced1 symset actually work,
yielding nice smooth outlines for swallowers and explosions. Or so I
think, I have only tested the former because when playing locally,
explosions disappear so fast I cannot see them.

While looking at where else glyph_to_swallow was used, I noticed that
parse_id subtracted S_sw_tl from glyph_to_swallow, even though it
returns 0 to 7. This looks like it would cause out-of-bounds access and
perhaps a segfault when trying to customise glyphs for individual
monster swallow glyphs (or whatever it is parse_id is used for), but
I haven't tried to confirm nor change this because who would ever do
such thing?
2024-09-02 01:04:31 +02:00
Doktor L
ede71dd1ac Convert glyph_to_cmap from macro to function
Even if nethack is meant to support compilers that do not know about
inline functions, this one was frankly too long to be a macro already,
and I'm about to make it longer still.
2024-09-02 00:39:00 +02:00
PatR
96787441e9 pauper tweaks
For 'pauper', most roles start without any skills.  However, strong
fighter types were starting with basic bare-handed combat/marital arts,
giving them a big advantage.  Knights were starting with basic riding,
which is probably useless now that they have to acquire a saddle to
use it (see below).  Take those initial skills away, producing an even
playing field.

Non-paupers get their initial skills without needing to spend any skill
credits (aka slots) on those.  Give paupers 2 starting credits that
they'll be able to use once they acquire suitable weapons or spells
and train them up, so that once they're reasonably developed they won't
lag in skills compared to non-paupers.

Pauper knights were still starting with a saddled pony.  Suppress the
saddle when the knight is a pauper.

Wizards start knowing a lot of spellbooks.  Pauper wizards shouldn't.

Give most roles advance knowledge of one low level spell or other item.
It won't benefit them unless/until they find the corresponding item.
2024-09-01 15:11:28 -07:00
nhmall
78042680b8 update tested versions of Visual Studio 2024-09-01 2024-09-01 09:39:56 -04:00
nhmall
7dfb57ac2e git credential helper documentation update
The most-current macOS version is greater than 12 (15 at time of
this change).

Expand Windows suggestions to include variations specific to MSYS2 and WSL2.
2024-09-01 09:31:35 -04:00
PatR
4415fc2154 revise a couple of recently added comments 2024-08-31 20:30:04 -07:00
PatR
dfe2619b4b github issue #1274 - meta keys on MacOS+tty
I can't post comments to github but can commit something that will
result in an update of the issue.  Hopefully you'll see the commit.

Issue reported by RetepV:  using the Macbook option key as an alt
key and using that as a shift with a regular key does not generate
a meta key value for the regular key.

This behavior is not new.  I see the same thing on OSX 10.11.6.

The curses interface calls meta(,TRUE) and <option>+key produces
M-key as intended with it.  The tty interface can't use that, even
when nethack is linked against a curses library which contains it.
But it should be possible to reproduce the functionality, at least
for some of the paths through the confusing conditional mazes in
sys/share/unixtty.c and win/tty/termcap.c.

However, my attempts to do that have been unsuccessful.  Fetching
and sending the termcap 'mm' sequence ('smm' for terminfo) wasn't
enough, tinkering with the internal terminal settings wasn't enough,
nor combining the two.  I'm not a UNIX guru so the internals part
was guesswork.  And after trying to look at the ncurses source code
in bafflement I've thrown up my hands and given up.

But all is not lost.  NetHack's 'altmeta' option can be used to
simulate meta keys.  It's intended to support terminals that transmit
<esc> X when you type <alt>+X.  But it also allows manually typing
<esc> X (as two separate keys rather than as a shift) when nethack
is waiting for a command.  They will be combined into M-X.  It works
when positioning the cursor too, so that when using number_pad you
can use <esc> <digit> to move the cursor multiple spots at a time.

'altmeta' deliberately doesn't work when assigning names to objects
or making wishes or various other text entry situations, nor in menus
where <esc> works in the usual way.  A potential gotcha is that if
you type <esc> when nethack is waiting for a command, the game will
just sit there until you type another key.  That can be another <esc>
since <esc> <esc> is converted into plain <esc> rather than M-<esc>.
2024-08-31 15:44:54 -07:00
PatR
0ce2439e82 github issue #1275: curses init vs pauper
Reported by ars3niy, the curses interface could behave strangely on
the first turn if the 'pauper' option/conduct was specified.

There isn't any definitive flag indicating whether or not the game
has started.  Since 'moves' has traditionally been initialized to 1
rather than to 0, there were several instances of
|  if (moves <= 1 && invent != NULL)
being used to determine the starting state on the assumption that
once hero has inventory, the game has begun.  Introduction of the
'pauper' option made the test for non-Null invent become unreliable.
For paupers, the program would behave as if the game hadn't started
yet until the player finally made a time-consuming move.

This changes compile-time initialization of 'moves' from 1 to 0,
then sets it to 1 when initial inventory would be bestowed (even
when 'pauper' inhibits that).  That's probably not the best place
for it, but testing for 'moves==0' now should produce an identical
effect as 'moves<=1 && invent!=NULL' used to accomplish.

It would have been much simpler just to give paupers 1 gold piece,
or perhaps one rock, in place of usual starting gear so that their
initial inventory wouldn't be empty, but the moves+invent way of
checking for start-of-play has always bothered me.

Should 'pauper' be preventing 'nethack -X' from giving its starting
wand of wishing?  Conducts and explore mode don't really overlap so
maybe it doesn't matter.

Fixes #1275
2024-08-31 14:08:04 -07:00
klorpa
02c4147893 Typos 2024-08-31 15:28:42 -05:00
PatR
8e85561725 cursesgraphics fix - S_engroom character
I normally force DECgraphics for tty and for curses so hadn't noticed
this before.  I recently let curses default to 'cursesgraphics' and the
engraving-in-room character was crossed horizontal and vertical bars,
the crosswall character.  It certainly stood out in the middle of a
room, but the emphasis seems out of proportion for "engraving here".

There is no 'epsilon' among the DEC line drawing characters.  Curses
might be able to render one, but not with DEC-style rendering of 0xEE.
Comment out S_engroom so that curses inherits the default backtick.
2024-08-30 14:19:19 -07:00
Pasi Kallinen
96fc77cc70 add pauper to fixes 2024-08-30 19:20:31 +03:00