Try to exercise ^A more when running the fuzzer. Also ^P, although
that is tty-centric.
I couldn't notice any difference in behavior so this doesn't seem to
be very useful.
End of line comments split across lines should start with '*' on the
continuation lines. Otherwise clang-format, if we ever run it again,
will mangle them by shifting the start of the comment from the end
of its line to be a new block comment on the next line.
[There are lots of these which ought to be fixed; I just happended to
be looking at monst.h.]
If there is at least one genocided or extinct type of monster, final
disclosure asks if you want to see the list. It was using "ynaq"
for the choice of answer, where 'a' is used to prompt for sort order
rather than "all". Change it to only include the 'a' choice if there
are more than 1 of either category or 1 each of both categories (since
they're listed interspersed with each other, sorting is relevant for
the one-of-each situation).
It seems surpristing that no one has noticed this since the code that
is responsible has been present for six months. Inventory list at
end of game included bogus "? - (list likely candidates)".
heaputil reported an attempt to free a null pointer at line 1314 of
cursdial.c (in menu_display_page()).
curses_break_str() can return Null but its callers aren't prepared
for that. Make it return an empty string that can be passed to
free() instead.
Iterating over a large set of locations in a selection caused a memory leak.
Lua couldn't do garbage collection in the middle of the iterator function,
so it eventually ran out of space, and just quietly dropped stuff.
A comment in rm.h claimed that secret doors can't be trapped so I
used door flag D_TRAPPED to handle secret doors that should be shown
as trees instead of walls. But the comment was inaccurate and secret
doors can be trapped.
Such trapped secret doors in ordinary rooms ended up being shown as
trees too. Switch from using D_ARBOREAL in levl[][].doormask to new
levl[][].arboreal_sdoor which overloads levl[][].candig.
Also, wizard mode wishing for secret doors needed updating to allow
creating trapped ones (at wall or door locations).
This ought to update EDITLEVEL but I think existing save files can
live with secret door display issues. Untrapped secret doors in
garden-fill rooms will end up becoming trapped.
Replaces the fix for github issue #1309
Commit 050846ada9 checked for
re_alloc(NULL,n) and returned alloc(n) for that case. After testing
MONITOR_HEAP and heaputil, the original code worked as intended.
I'm not sure what was going wrong yesterday.
Switch back to the previous code. I could have used 'git revert'
but haven't.
I hope this is temporary. nhrealloc() intends to deal with
realloc(NULL, size) but something isn't working correctly. The
code in alloc.c looks right so the problem might be in heaputil.
However, the code there looks ok too.
Not sure why my earlier attempt was unsuccessful. This one isn't as
comprehensive but is simpler and better yet, works as intended.
When saving a level or exiting the program, objects can be deleted
directly rather than having to pass though the objs_deleted list.
If the yn_function() delivers its impossible about returning a result
that isn't considered to be viable, put the prompt into paniclog.
The updated comment contains my guess about what it going wrong, and
I'm fairly sure it is correct. But I don't know how to fix it unless
we change ^A to just repeat the last command without attempting to
also repeat whatever followed.
At the moment, users will occasionally get strange outcome from ^A.
'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.)
'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.
Warning about missing parantheses when mixing '+' and '?:'. It didn't
cause 'make' to quit but resulted in incorrect score-in-progress values
eing generated.
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
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.
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 ...