Commit Graph

17742 Commits

Author SHA1 Message Date
PatR
00a5d811ee monmove.c: remove a couple of trailing spaces 2025-03-19 07:48:12 -07:00
PatR
ef9734f1c1 another 'nethack --dumpweights' tweak
Don't suppress slime mold.
2025-03-19 01:39:01 -07:00
PatR
ec6632352f 'nethack --dumpweights' tweak
In the generated comments accompanying weights, show /* a novel */
rather than /* a spellbook of novel */.
2025-03-18 11:53:58 -07:00
Pasi Kallinen
a64796e64d Flip monster goal when flipping the level 2025-03-17 14:33:01 +02:00
nhmall
8c0c33aa1f another follow-up bit 2025-03-17 08:09:00 -04:00
nhmall
ed406dafe7 follow-up: store square of dist in arwep table
Also includes some additional unrelated #undef's since one was
being added.
2025-03-17 07:38:37 -04:00
PatR
f7a390db11 fix #K4324 - Xp and Exp highlit after restore
Experience-level and experience-points, if enabled, could be
highlighted via 'up' or 'changed' rules in initial display after
restore.  I tried 'down' rule too but didn't produce with that.

I don't understand what was going on but was able to reproduce it
and then fix it via the trial and error method....
2025-03-16 19:37:40 -07:00
nhmall
d53698baea whitespace at end-of-line 2025-03-16 15:39:22 -04:00
nhmall
0bdf9830e6 throw-and-return weapons used by monsters
Resolves #1338
2025-03-16 15:37:49 -04:00
Pasi Kallinen
7c43654580 Lua: allow functions for some optional strings
Those places that use get_table_str_opt() to get an optional string
value can instead use a function that returns a string.
This can be used for example in quest data lua table, or some table
fields in the lua api bindings, or the dungeon definition.

For example, in quest.lua

text = "You again sense %l pleading for help.",

could be replaced with

text = function() return "You again sense %l pleading for help."; end,

which of course allows using lua to build the string.
2025-03-16 20:29:28 +02:00
nhmall
53cbccdb86 warning bit from the door fix earlier
mklev.c(97,14): warning C4389: '!=': signed/unsigned mismatch
2025-03-16 08:42:42 -04:00
nhmall
e164ce0af4 rings were missed in --dumpweights text 2025-03-16 08:41:08 -04:00
Pasi Kallinen
b2c071bc66 Fix rare door in corner of room bug
There were couple reports of doors being generated in a corner
of a room.  This happened for randomly generated irregular rooms,
because the code that was deciding if a corridor starting or
ending location was good did not handle irregular rooms at all.

This changes the corridor code so it can now generate start and
end points properly for any valid position in irregular rooms,
instead of only on the edges.  This means the corridor sometimes
meanders a bit more than before, because it tries to find
the end point away from the edge of the room rectangle.

Also added is sanity checking for the randomly generated rooms
and corridors level, testing for door placement and room connectivity.

And another fix for a rare special case where dig_corridor
created a zero-tile long corridor; the entrance door was placed,
but there was nothing behind it.

Fixes github #1269 and #1385
2025-03-16 09:46:53 +02:00
nhmall
ef6ca6c5fa follow-up for --dumpweights
Use a string compare for the sort and encode the weight
at the beginning of the string
2025-03-15 23:18:01 -04:00
nhmall
b169b79d36 dump monster and obj weights using --dumpweights 2025-03-15 19:55:49 -04:00
Pasi Kallinen
488011571a Fix vision when vault guard corridor vanishes 2025-03-15 22:20:59 +02:00
nhmall
ef4cd7608d follow-up for pull-request #1397
Fix warnings
objnam.c: In function ‘wizterrainwish’:
objnam.c:3536:54: warning: variable ‘didblock’ set but not used [-Wunused-but-set-variable]
 3536 |     boolean madeterrain = FALSE, badterrain = FALSE, didblock, is_dbridge;
      |                                                      ^~~~~~~~
2025-03-14 10:34:22 -04:00
nhmall
57825b170d pull request #1397 by copperwater
Closes #1397
2025-03-14 10:00:35 -04:00
PatR
90717ca633 more chest->tknown handling
Disarming a chest trap was setting obj->tknown = 0 even though the
hero just discovered that it isn't trapped.

Triggering a chest trap behaved similarly.  Since there are no
repeating chest traps, hero should know that the chest whose trap
just went off is no longer trapped.

chest_trap() didn't document its return value but was clearly meant
to return True if the chest was destroyed.  It didn't handle that
correctly when the chest was being carried.  However, none of the
callers actually use the return value.  [This fix tracks whether the
chest gets deleted; a better fix would be to destroy an exploding
chest even when it is being carried.]
2025-03-13 13:54:56 -07:00
nhmall
9b0724f8f2 update tested versions of Visual Studio 2025-03-13 2025-03-13 12:57:55 -04:00
nhkeni
67dc6662ac remove bogus content from template file 2025-03-13 12:48:07 -04:00
nhmall
dfe2a967fc fix a recent typo 2025-03-13 07:40:20 -04:00
PatR
31d86a8c41 trapped box->tknown
If 'autounlock' is set to test a chest for traps, skip "check for
traps?" when tknown is set; go directly to "disarm trap?" if the
chest is trapped, skip that too if it isn't.

If wand of probing hits a chest, set the tknown bit.
2025-03-12 01:28:05 -07:00
nhmall
8f84f76f09 stop a warning when compiling util/stripbs.c 2025-03-11 10:46:08 -04:00
nhmall
4a67caf3d7 document musl=1 in README-hints 2025-03-11 10:27:18 -04:00
PatR
1d22a396d4 fixes3-7-0 typo 2025-03-10 21:54:22 -07:00
nhmall
8abd9e9564 comment wording bit 2025-03-10 20:29:38 -04:00
nhmall
d6829cdcd2 fixes entry for musl libc build, rather than glibc
We've had reports of a couple of issues building against musl libc.

Issues reported:
  - build procedures utilize col for Guidebook-creation, and col
    is deprecated in distros that use musl libc

  - some of the CRASHREPORT code is using library functions that
    are not available in the musl libc environment. The reported
    functions were backtrace() and backtrace_symbols(), which use
    header file /usr/include/execinfo.h.

So we'll try to accommodate this. Since we don't have a means of
autodetecting the musl libc situation during the build (as of yet), the
builder will have to specify 'make musl=1' on the make command line.

Specifying 'musl=1' on the make command line will:
1. ensure that NOCRASHREPORT gets defined in the C preprocessor.
2. set COLCMD to be '../util/stripbs' instead of 'col -bx'.

Related to GitHub #1393
2025-03-10 19:54:12 -04:00
nhw_cron
e300c205c6 This is cron-daily v1-Apr-1-2024. 000files updated: Files 2025-03-10 17:25:28 -04:00
nhmall
fbb8ef2fa6 follow-up: set STRIPBS in Makefiles 2025-03-10 17:18:58 -04:00
nhmall
bddca2ded5 musl libc build, rather than glibc
We've had reports of a couple of issues building against musl libc.

Issues reported:
  - build procedures utilize cat for Guidebook-creation, and cat
    is deprecated in distros that use musl libc.

  - some of the CRASHREPORT code is using library functions that
    are not available in the musl libc environment. The reported
    functions were backtrace() and backtrace_symbols(), which use
    header file /usr/include/execinfo.h.

So we'll try to accommodate this. Since we don't have a means of
autodetecting the musl libc situation during the build (as of yet), the
builder will have to specify 'make musl=1' on the make command line.

Specifying 'musl=1' on the make command line will:
1. ensure that NOCRASHREPORT gets defined in the C preprocessor.
2. set COLCMD to be '../util/stripbs' instead of 'col -bx'.

Closes #1393
2025-03-10 17:14:24 -04:00
PatR
719166f9ec fix issue #1377 - Forcefight vs displacer beasts
Issue reported by elunna:  Using the 'F' prefix against a displacer
beast prevented swapping places.

This doesn't use the suggested fix.  It is quite short but there is
a large diff due to change in indentation and reformatting several
comments because of that.

Attacking a displacer beast either with or without 'F' might miss,
hit, or swap places.  It won't "harmlessly attack thin air."

Fixes #1377
2025-03-10 09:17:41 -07:00
PatR
0a180c52ef more issue #1362 - carrying Mitre of Holiness
Protect carried items as well as hero when carrying the Mitre of
Holiness.  Already handled when wearing that artifact.

This might make it be too strong.  At the time that it was given
the carrued attribute, there was no such thing as carried items
providing any protection to other carried items.
2025-03-09 14:28:50 -07:00
nhmall
3b15e4fff2 a pair of duplicate #include statements in hack.h 2025-03-09 09:51:12 -04:00
PatR
a3c6eec5c0 enlightenment about bones
"You have disabled loading of bones levels" (during play) and
"You disabled loading of bones levels" (end of game disclosure)
both clearly refer to the player rather than the hero.
"You have never encountered a bones level" is accurate for current
hero but not necessarily accurate for the player.  Rephrase it.

Also, if OPTIONS=!bones is set and the hero just died, extend
"You disabled loading of bones levels" during disclosure to
"You disabled loading and storing of bones levels" (even in the
case where bones wouldn't be saved anyway).
2025-03-08 13:16:27 -08:00
nhmall
d0d77ed5f4 related comments were not updated with parameters 2025-03-08 12:51:53 -05:00
copperwater
49b43f760f Fix: a number of unblock_points shouldn't unblock unconditionally
Initially diagnosed in an xnethack fuzzer crash - unblock_point
shouldn't be called when a closed door becomes non-closed, because it's
possible that there's a gas cloud on the space which means it still
blocks vision. These always need to be recalc_block_point. A number of
them were fixed, but when I went through all the xnethack ones, I found
some that were unchanged from upstream NetHack. I reproduced the sanity
check impossibles usually by breathing gas at a door as an iron golem
and then opening or destroying the door to trigger the unblock_point
call.

The use of recalc_block_point in wizterrainwish was not triggering this
bug, but the previous code there basically duplicated
recalc_block_point.
2025-03-08 07:53:57 -05:00
PatR
a6a1e1b365 nasty() tuning
Another old stash.  Slighty weakens genocide of high level monsters.
2025-03-07 12:14:22 -08:00
PatR
6a24d5ac04 report.c tweaks
The report.c bit committed today reminded me that I had an old stashed
change for that file.  There should be no change in behavior.
2025-03-07 12:07:17 -08:00
nhkeni
adeb69ba82 report.c: fix HASH_BINFILE typo 2025-03-07 13:34:53 -05:00
nhmall
ceee6aff31 pointer decl style consistency; use any_types enum 2025-03-06 07:20:16 -05:00
nhmall
78ca37290b cast style tidbit 2025-03-05 10:29:50 -05:00
nhmall
fd49242015 botl.c follow-up 2025-03-05 08:55:27 -05:00
nhmall
90d240cbb8 revert assert addition 2025-03-05 08:17:09 -05:00
nhmall
3ef8ae3cc1 Merge branch 'parse_status_hl2' of https://github.com/argrath/NetHack into NetHack-3.7 2025-03-05 08:08:27 -05:00
nhmall
2202b9b8ab Merge branch 'swallowit' of https://github.com/argrath/NetHack into NetHack-3.7 2025-03-05 08:06:38 -05:00
nhmall
ebeebcc427 Merge branch 'removemagic' of https://github.com/mkuoppal/NetHack into NetHack-3.7 2025-03-05 07:59:43 -05:00
copperwater
01cdf51993 Add a bit of detail in selection.room() documentation
It wasn't clear to me how selection.room() handles room edges and
unusual terrain in the room, so I looked at the code and wrote down how
it behaves for posterity.

I don't believe the one room currently capable of getting a random fill
while already containing some odd terrain, "Blocked center", actually
has unusual terrain in the room fill. This is because filler_region
creates an irregular region (i.e. a room containing the ROOM points in a
square ring around the blocked center). The points in the middle don't
share the same roomno, so they won't be returned in the selection
created by selection.room(). But there's no reason a room couldn't be
added in the future which does specify some nonstandard terrain and then
a themeroom fill.
2025-03-04 18:46:31 +02:00
copperwater
50d80b5183 Fix: map random y-placement used its width instead of height
Not sure how long this has existed without triggering any issues, but
when I was testing out a themed room wider than it was tall, I ran into
rn2-of-a-negative-number impossibles. Traced it to here, where it was
trying to subtract the width of the mapfrag from ROWNO to figure out
which y-value it should place the map on. The correct behavior is to
subtract the height of the mapfrag.
2025-03-04 18:46:31 +02:00
copperwater
55c3a7c6c5 Fix: sitting on bidirectional teleportation traps
It is possible to create a bidirectional teleportation trap by making a
pair of teleportation traps with a fixed destination of each other's
coordinate. Moving or hurtling onto such a trap correctly materializes
the hero on top of the other trap without triggering it, but for some
reason I didn't dig into, sitting down to trigger the first trap does
also trigger the second one at the destination end, causing you to
counterintuitively teleport twice and end up back where you started.

Fix this by stopping tele_trap() from doing anything if it's called
recursively, using a static variable like spoteffects() does for the same
purpose. I had to adjust a bit of other tele_trap code to remove its
sole early return.
2025-03-04 18:43:14 +02:00