Commit Graph

16394 Commits

Author SHA1 Message Date
nhmall
b2f7c56e95 adjust comment wording for beyond 3.6 2024-01-23 11:00:23 -05:00
Pasi Kallinen
90cc3102f5 Don't use static buffer 2024-01-23 17:56:02 +02:00
Pasi Kallinen
a45f07c9b4 Comment typo 2024-01-23 17:32:32 +02:00
Pasi Kallinen
50df01c3e1 Split out empty hands menu option text 2024-01-23 17:27:07 +02:00
Pasi Kallinen
70d8d9e0d1 Unify getting coords or region from lua table 2024-01-23 13:37:16 +02:00
Pasi Kallinen
bce7c69e77 Unify wake up and scare a monster by music 2024-01-23 13:23:51 +02:00
Pasi Kallinen
49338ebb0a Split gem color randomization 2024-01-23 13:07:52 +02:00
PatR
03827fd184 pull request #1178 - PYEC data.base entry
Pull request from entrez:  revise the Platinum Yendorian Express Card
data.base entry for style and remove out of date assertion that it is
unreadable.

Closes #1178
2024-01-22 17:13:43 -08:00
Michael Meyer
3025e05579 Copyedit PYEC encyclopedia entry
I initially went in here to change the description of "unreadable" text
on the card, since it has been possible to read it in-game since commit
870b124 in 2015.  Then I also ended up making some edits to stylistic
issues I noticed, primarily varying vocabulary to eliminate the
repetition/reuse of words in phrases like "an /ancient/ artifact...
inscribed with /ancient/ runes" and "when /carried/, it grants the one
who /carries/ it ESP, and reduces all spell damage done to the
/carrier/".  The result is a little bit tighter and I think reads
somehwat better.
2024-01-22 17:13:13 -08:00
PatR
bba6942082 remove unused variable 2024-01-22 17:10:14 -08:00
PatR
5540e266c4 pull request #1174 - trapeffect code cleanup
Pull request from entrez:  some old trap code became obsolete or
at least less useful when the trap routine was split into separate
routines for each type of trap.  The type of trap currently being
handled is already known by each of those routines.

Closes #1174
2024-01-22 17:04:02 -08:00
Michael Meyer
a3e8d8eacb Clean up trapeffect code a little bit
Some minor cleanup of artifacts from the splitting up of trap effects
into the various trapeffect_foo functions: consolidate redundant
variables in trapeffect_pit (tt vs ttype), and simplify the definition
of 'inescapable' traps a couple functions (since the functions are now
specialized to a particular trap, it's unnecessary to check ttype
there in determining whether it's an inescapable Sokoban pit or hole).
2024-01-22 17:02:59 -08:00
PatR
36fef49306 pull request #1177 - saving bones
Pull request from janne-hmp:  defer releasing the memory for the
current level by having savebones() using write mode rather than
write+free mode.  nh_terminate() -> freedyanmicdata() will free the
current level.

Matters for 3rd party html dumplog (which nethack doesn't support).

The commit message is misformatted and misleading but it's a bit
late to fix that now.

Closes #1177
2024-01-22 16:56:41 -08:00
janne-hmp
22d26b7653 Saving a bones file should not free memory; the function really_done will be using that information after the call to savebones, resulting in a heap-use-after-free error (and possibly later in a double-free in nh_terminate if things get that far). 2024-01-22 16:31:51 -08:00
PatR
77d7c449e0 build fix for dlb 2024-01-22 13:31:48 -08:00
PatR
fabc9033aa loadstone bit
If your inventory is full and you aren't already carrying a loadstone,
you can pick one up into the overflow slot.  But if you are already
carrying one and the one you're trying to pick up won't merge with it
(only criterium that matters would be BUC state, I think), you can't
pick it up and get a message saying so.  If loadstone isn't known
yet, the message always referred to it as "gray stone" rather than
"stone called <whatever-you-called-it>".
2024-01-22 13:25:32 -08:00
PatR
7c1512fa99 avoid strnlen()
Replace the single strnlen() use with strlen() so as not to require
something from posix.1 (2008) when we supposedly only require c99.

If someone manages to produce a string that's longer than will fit
within size_t, strlen()'s length count will wrap and Strlen_() might
not notice.  Since size_t has to be at least 32 bits, that doesn't
seem like something to worry about.

If checking for size_t overflow is considered essential, we should
just switch to counting the length via an in-line loop that imposes
a similar limit to strnlen().
2024-01-22 12:59:51 -08:00
nhmall
7f8c7dda64 Merge branch 'rotten-rottables' of https://github.com/bitofhope/NetHack into NetHack-3.7 2024-01-22 11:08:30 -05:00
Pasi Kallinen
baeb1d925f Change some ints to coordxy 2024-01-22 17:02:40 +02:00
PatR
5d90499148 doname bounds checking bits
When ready to return, check for overlooked overflow (shouldn't happen)
and panic, or report the first excessively long but not overflown
description to paniclog, similar to xname.

Make ConcUpdate() more robust by not needing bp_eos to be previously
set.  Less efficient but I think that boat has left the barn?  :=}

Fix a comment typo.
2024-01-21 17:43:55 -08:00
Pasi Kallinen
96902f4ff0 Split populating a random maze 2024-01-21 22:48:41 +02:00
PatR
13ff565a67 github issue #1201 - Forcefighting webs
Issue reported by Umbire:  suggestion to always destroy adjacent webs
via 'F'<dir> if wielding Sting or Fire Brand.

Sting already did that; this adds Fire Brand.

This also augments the #untrap command when wielding either of those,
or any other blade.  And rephrases successful untrap message
"You remove {the or your} {bear trap or webbing} from Fido." to
"You extract Fido from {the or your} {bear trap or web}." since the
trap remains intact.

Forcefight and #untrap against webs ought to be reconciled to remove
[some of] their differences and/or share code.  But not by me...

Closes #1201
2024-01-21 11:58:44 -08:00
nhmall
81b45f92c8 static analyzer bit in sounds.c 2024-01-21 14:09:46 -05:00
PatR
9e640fb14e gcc warning fix
Avoid two new warnings in xname_flags() about strncpy() not supplying
a terminating '\0'.  That's exactly why strncpy() was being used.

The gcc manual lists -Wno-stringop-truncation to suppress the warning
but not -Wstringup-truncation to voluntarily enable it, so the pragma
stuff in warnings.h probably won't work for this.  Just switch from
strncpy() to memcpy() instead even though it seems like obfuscation.
2024-01-21 11:01:45 -08:00
nhmall
d4f04fbdc8 static analyzer bit in options.c
Analyzer didn't like the use of strchr on an incomplete type.
Move the guts into a function in o_init.c.
2024-01-21 13:38:25 -05:00
nhkeni
6f47094b8d Add a sanity check to nhl_init() 2024-01-21 12:44:05 -05:00
nhmall
0b684339ef more vestiges of C(color) 2024-01-21 11:12:13 -05:00
PatR
1a2b2a8cae object formatting fix for charged rings
The bounds checking code for object formatting had a typo that left
out the space between +N and <ring of type>.
2024-01-21 07:58:25 -08:00
nhmall
8f35e33a2e follow-up nonnull in u_init.c
u_init.c had had assessments for nonnull arguments on
its local functions carried out already.

A couple of new static functions added earlier today immediately
dereference their args, so declare those as nonnull.

This also gives a more self-describing name to one arg.
2024-01-21 09:48:36 -05:00
Pasi Kallinen
f889478262 Split ini_inv obj wear/wield/learn 2024-01-21 14:34:21 +02:00
Pasi Kallinen
2f5851e394 Split ini_inv object field adjustments 2024-01-21 14:16:06 +02:00
Pasi Kallinen
f1bf2418ff Split ini_inv obj race substitutions 2024-01-21 14:02:09 +02:00
Pasi Kallinen
d2e7bfa6cd Split out ini_inv filtered mkobj 2024-01-21 13:46:20 +02:00
Pasi Kallinen
8615401278 Split out initial STR and CON boost if inventory too heavy 2024-01-21 12:51:46 +02:00
Pasi Kallinen
311e82a9cc Split init attr minor variation 2024-01-21 12:45:13 +02:00
Pasi Kallinen
1d4cdf09f6 Split u_init race specific stuff 2024-01-21 12:38:06 +02:00
Pasi Kallinen
2e56598779 Split u_init role specific stuff 2024-01-21 12:34:43 +02:00
Pasi Kallinen
a46e41816b Split freeing proto_dungeon data 2024-01-21 12:17:06 +02:00
Pasi Kallinen
0eb96d7ed6 Split special level location fixup 2024-01-21 12:11:22 +02:00
Pasi Kallinen
f34a07a3d2 Split out castle tune init 2024-01-21 11:55:29 +02:00
Pasi Kallinen
0e64fddec1 Split out dungeon parsing 2024-01-21 11:51:15 +02:00
PatR
593a93d254 obj->how_lost fix
PR #1140 added checking the thrown, stolen, and dropped flags of an
item when testing whether it would merge (at my suggestion...) with
a stack in the target list (hero's invent).  That interferred with
picking it back up--whether via autopickup or explicit pickup--while
inventory was full even when the item would otherwise be mergable.

There was some trial and error involved when trying to figure where
to put the fix but things seem to be working.

This replaces a static analyzer workaround and could possibly bring
its unwarranted complaint back.
2024-01-21 01:17:18 -08:00
Pasi Kallinen
5bf258629a Split up hero attribute init 2024-01-21 10:41:57 +02:00
PatR
7b1ec30d0d bounds checking by doname() and xname()
Try harder to prevent buffer overflow when formatting objects.
I don't have any test cases where overflow has been happening so
don't really know whether this works reliably.  And it doesn't try
to check prefix construction by doname().  [Yet?]
2024-01-20 17:53:44 -08:00
Pasi Kallinen
414ee6eba7 Split setting up dungeon depth 2024-01-20 16:25:13 +02:00
Pasi Kallinen
1c0662ddd7 Split setting up dungeon entry level 2024-01-20 16:18:06 +02:00
Pasi Kallinen
d5fba06837 Split dungeon branch parsing 2024-01-20 16:00:02 +02:00
Pasi Kallinen
57747535af Add m_next2u, analogous to m_next2m and next2u 2024-01-19 21:53:25 +02:00
PatR
b6bc3ef698 more Guidebook for containers
"blue potion" wasn't a very good example for an item in a container;
plain "blue" isn't a potion description.

Add an extra sentence to make the association between a container's
"item count" that's really a stack count and the fact that inventory
slots are for stacks rather than for individual items too.

Style/usage bit: avoid using "another" twice in the same sentence.

Fix a typo in the spelling of "contents".
2024-01-19 10:44:39 -08:00
Pasi Kallinen
ce34239885 Zero init the NhRect 2024-01-19 18:19:56 +02:00