Commit Graph

17820 Commits

Author SHA1 Message Date
PatR
a6ffebf320 another MONITOR_HEAP bit
'heaputil' complains about free(NULL) because that wasn't handled
consistently back in the pre-standard days.  Avoid using that.
2025-04-17 11:40:07 -07:00
PatR
b03e1ee3cb purging deleted objects
I don't think that this fixed any of the 'heaputil' complaints, but
it makes deleted object handling more consistent with dead monster
clearup.
2025-04-17 10:17:28 -07:00
PatR
f307f05afd another MONITOR_HEAP
'unsigned long' isn't big enough to hold a pointer in my configuration,
and the old "only micros are sure to support %p format" is long out of
date.  Just assume that everyone has %p these days, and provide a hook
to avoid it for anyone who doesn't.  (Opt-out instead of opt-in.)
2025-04-17 10:10:52 -07:00
PatR
f1ba320cb3 memory tracking fix
'heaputil' is producing a lot of complaints.  This fixes one of them,
about freeing memory that was never allocated.  In this case, it's
when removing an overview annotation for a level.  The annotation
is using dupstr_n() and not being recorded due to dupstr_n() being
placed after MONITOR_HEAP undefines the macro that overrides alloc().

There's only one use of dupstr_n(), and its length checking isn't
needed there, so just switch to dupstr() and comment out the
implementation of dupstr_n().  I left the prototype in extern.h;
that's harmless.

If dupstr_n() needs to be resurrected, a second MONITOR_HEAP-aware
version should be implemented, with corresponding macro to choose
which one to use.
2025-04-17 10:06:46 -07:00
Pasi Kallinen
178bd3a988 Wielding Trollsbane grants hungerless regeneration 2025-04-17 17:28:07 +03:00
nhmall
c88b288329 yet another stale ZEROCOMP bit 2025-04-16 17:04:45 -04:00
nhmall
16fc4aacb1 another stale ZEROCOMP bit 2025-04-16 17:00:21 -04:00
nhmall
830e18f52e some cleanup of stale bits 2025-04-16 16:56:17 -04:00
PatR
d4008772ac build fix for SCORE_ON_BOTL
Warning about missing parantheses when mixing '+' and '?:'.  It didn't
cause 'make' to quit but resulted in incorrect score-in-progress values
eing generated.
2025-04-16 13:17:36 -07:00
PatR
f887ba7704 build fix for MONITOR_HEAP
Compile of alloc.c failed when MONITOR_HEAP is defined.
2025-04-16 13:14:42 -07:00
PatR
a7412dc835 add '--debug:fuzzer' command line option
Provide a way to bypass a debugger when initiating fuzzing.
 nethack -D --debug:fuzzer        # run fuzzer in wizard mode
 nethack --debug:fuzzer           # run it in normal mode
 nethack [-D] -@ --debug:fuzzer   # skip role/race/&c selection
2025-04-16 12:46:28 -07:00
nhmall
15fa0758f2 put added comment in the correct place 2025-04-16 13:39:32 -04:00
nhmall
e024cbc57a go.omoves to svo.omoves since it is read from savefile 2025-04-16 12:45:32 -04:00
Pasi Kallinen
86bfb3e2f9 Avoid map accessibility notices when map isn't updated 2025-04-16 18:08:33 +03:00
nhmall
01e031e639 visual studio recover project update 2025-04-16 10:10:34 -04:00
nhmall
799e252c21 GNUmakefile requires slashes between macro and file 2025-04-15 21:08:03 -04:00
nhmall
8c23cfe4e4 some cleanup 2025-04-15 21:03:59 -04:00
nhmall
c2a2d5e344 fix some issues with recover unrelated to today's changes 2025-04-15 21:02:16 -04:00
nhmall
dcb0fc7654 remove unused target from Makefile.utl 2025-04-15 20:03:28 -04:00
nhmall
6cf9415b72 add define to GNUmakefile build 2025-04-15 20:01:02 -04:00
nhmall
28d2ff516c sys/windows/GNUmakefile recover 2025-04-15 19:58:25 -04:00
nhmall
5560bdb27c msdos recover 2025-04-15 19:53:50 -04:00
nhmall
46d4639d66 visual studio build fix (for recover) 2025-04-15 18:56:34 -04:00
nhmall
44af2a96a5 recover utility updates 2025-04-15 18:02:44 -04:00
nhmall
502b60d210 follow-up bit
oextra should have been included in the critical bytes
2025-04-15 15:49:36 -04:00
nhmall
a3e12550ea savefile changes - part 1
This is the first of several savefile-related changes to
follow later. This one is groundwork for those later changes.

Remove internal compression schemes (RLECOMP and ZEROCOMP)
and discard the savefile_info struct that was primarily used to
convey which internal compression schemes had been in use.

Relocate some struct definitions into appropriate header files
for use by code to come in later changes.

Remove the two struct size-related fields from version_info and
from the nmakedefs_s. Instead, include a series of bytes near the
beginning of the savefile, representing the size of each
struct or base data type that impacts the historical savefile
content. Those are referred to as the "critical bytes".
(Related note: the "you" struct required two bytes, low and high,
due to its size).

Compare those critical bytes in a savefile against the NetHack
build that is reading the savefile. This allows mismatch detection
early in the savefile-reading process, and a clean exit, rather than
proceeding to read nonsensical values from the file. Include some
feedback on what the first mismatch was when encountering
one.

For arrays stored in the savefile, use loop-logic in the core
to write/read the array elements one at a time, rather than in
a single blob. This will be required for changes to follow later.
(impacts artiexist[], artidisco[], svd.dungeons[], svl.level_info[],
svl.level.locations[][], msrooms[] field of mapseen, svb.bases[],
svb.disco[] objects[], svm.mvitals[], svs.spl_book[], svd.doors[],
go.oracle_loc[], utrack[], wgrowtime[])

This also adds data model to the long version information.

This invalidates existing save and bones files due to the changes in
the information at the start of the file.
2025-04-15 15:35:17 -04:00
Pasi Kallinen
af3e601ff7 Remove melting ice timer when breaking digging wand 2025-04-15 14:45:51 +03:00
Pasi Kallinen
d6dd5c743c Reinstate some of the mind flayer amnesia
When I reworked amnesia to not forget levels or objects, I removed
the forgetting from the mind flayer attacks.  I intended to add
something to replace it, but forgot ...
2025-04-13 20:16:00 +03:00
nhmall
932f598689 follow-up bit 2025-04-13 12:23:09 -04:00
nhmall
a70db6dafb WIN_MAP==WIN_ERR on a code path to tty_wait_synch 2025-04-13 12:14:38 -04:00
Pasi Kallinen
a185c270bb Expose trap once-field to lua 2025-04-13 17:32:14 +03:00
nhmall
eeb96c4151 update tested versions of Visual Studio 2025-04-13 2025-04-13 10:22:59 -04:00
Pasi Kallinen
85de51a69a Add invocation effect to Fire and Frost Brand
Casts fireball or cone of cold at expert level
2025-04-13 13:13:54 +03:00
Pasi Kallinen
652f8576c0 Cursed magic whistle can teleport you to your pet 2025-04-13 12:48:21 +03:00
PatR
e26a496088 fix issue #1309 - secret doors in Garden rooms
Issue reported by elunna:  when a room gets converted into a theme
room with fill type Garden, its walls are changed to trees but any
secret doors in those walls are still displayed as regular walls.

This adds a new D_ARBOREAL flag for secret doors, used to force them
to be displayed as a tree instead of a wall.

Fixes #1309
2025-04-12 17:21:40 -07:00
PatR
8f344a30b5 github PR #1399 - add "Murphy" to ghost names
Pull request from greg-kennedy:  add "Murphy" to the list of random
ghost names.

Closes #1399
2025-04-12 12:33:10 -07:00
PatR
efee4553b6 github PR #1394 - "Mine's End" epitaph
Pull request from chappg:  add "I have reached Mine's End" to the set
of epitaphs.

Blame the explantory comment on me.

Closes #1394
2025-04-12 12:19:50 -07:00
Greg Chappell
9821caf984 Add "I have reached Mine's End" epitaph 2025-04-12 12:10:11 -07:00
PatR
a05cca16ef fixes entry for PR #1408, typos in tribute names
Pull request from rbsec:  a couple of character names had misspellings.

Closes #1408
2025-04-12 10:43:32 -07:00
rbsec
6a74f46c25 Fix a couple of incorrect names in the Terry Pratchett tributes 2025-04-12 10:36:37 -07:00
PatR
ab8ab7b344 more THEMERM and THEMERMFILL
Give a little more information if environment variable THEMERM or
THEMERMFILL has an invalid value.
2025-04-12 10:22:52 -07:00
Pasi Kallinen
8f7258dc35 Buff Grimtooth with poison
Grimtooth is now permanently poisoned, protects the wielder from
poison, and can be invoked to throw poison.

Permapoison code comes from xNetHack by copperwater <aosdict@gmail.com>.
2025-04-12 19:24:36 +03:00
PatR
48d1b8617e themerms.lua formatting
Do some reformatting of dat/themerms.lua.  I didn't try to reproduce
the changes that were in the reverted commit, and didn't slow through
to the end.
2025-04-11 17:07:55 -07:00
PatR
1fd27044b7 github PR #1384 - THEMERM and ThEMERMFILL
Pull request from copperwater:  reorganize the theme rooms data so
that a room or a fill can be chosen by name, and when in wizard mode,
consult environment variables THEMERM and THEMERMFILL during level
creation to provide control over which theme rooms/room fills to
generate.

I reverted a commit that did a bunch of reformatting to themerms.lua
because to caused substantial merge conflicts.  I will redo at least
part of it.

Closes #1384
2025-04-11 16:29:08 -07:00
copperwater
3427c43df2 Guard against no themed rooms or fills being eligible to generate
The themed room code previously assumed that on any given level, at
least one room or fill would resolve as OK to generate there. However,
that's not a great assumption to make, and if it happened to be broken,
the first themed room or fill would arbitrarily be executed, even though
it wasn't eligible. Fix that by setting the initial pick to nil, and
raising an impossible if it's still nil after trying to choose a random
room.
2025-04-11 16:27:34 -07:00
copperwater
47e6edc663 Enable generating specific themed rooms for debugging
A common pain point I encounter when working on themed rooms is making
specific rooms generate. The only ways to do this were mass commenting
out the rooms not being tested, or hacking in different room frequency
values (even more annoying when testing a fill, not a room, or testing
pure-function rooms/fills that have no frequency).

This change solves that problem by allowing a wizard-mode user to define
THEMERM or THEMERMFILL environment variables to make specific rooms or
fills generate.

The first part of this change is converting all themed rooms and fills
that were plain functions into tables, and converting their comment
names into actual names in those tables. The names are not intended to
be shown during gameplay, but instead serve as values that THEMERM or
THEMERMFILL can be matched to to generate those rooms. It's no longer
possible to have a function themeroom; this will raise an impossible.
As far as I'm concerned, this is a good change because it allows some
code simplification of themerooms_generate and makes it easier to add
difficulty or eligibility parameters to rooms.

The second part of this change is adding a new nh.debug_themerm function
to make the environment variable values accessible to themerms.lua. I
looked for an existing way to do this but didn't see one (nh.variable
is the closest but appears to be for variables that get saved).

The final part is inserting behavior into the actual themeroom
generation code that changes how they generate when either a room or a
fill is set. I don't think it's safe to generate every single room with
the requested type or fill - that might lead to cases where the stairs
or a magic portal cannot generate. So it creates ordinary rooms half of
the time, which still results in plenty of themed rooms on levels.

Another thing to note is that any themed room using filler_region will
still only pick a fill 30% of the time. If one specifies both a fill and
a room that uses filler_region, many of those rooms will appear without
a themed fill.
2025-04-11 16:27:34 -07:00
PatR
5a910f3df7 Revert "whitespace cleanup for themerms.lua"
This reverts commit eee5a1698b.
Easier to commit PR #1384.
2025-04-11 15:19:06 -07:00
Pasi Kallinen
7138af00ba Praying on an altar with pet statue on it can revive the pet 2025-04-10 23:38:44 +03:00
Pasi Kallinen
197e6af78c Increment EDITLEVEL for silver maces 2025-04-09 21:26:22 +03:00
Pasi Kallinen
fa229439d4 Fixes entry for silver mace
Fixes #1405
2025-04-09 21:05:59 +03:00