Commit Graph

16434 Commits

Author SHA1 Message Date
nhmall
4d09009fff Guidebook follow-up 2024-01-29 10:56:16 -05:00
nhmall
b9bf956ec9 follow-up 2 for italic 2024-01-29 10:55:44 -05:00
nhmall
d3dd9277f9 follow-up 1 for italic 2024-01-29 10:00:06 -05:00
Pasi Kallinen
41edcdf6d9 Mention italic for status hilites in Guidebook 2024-01-29 16:48:31 +02:00
nhmall
0dfe92ac61 more italic support
There might be some follow-ups to this.
2024-01-29 08:40:05 -05:00
Pasi Kallinen
74a1caf536 Qt: support italic in menucolors 2024-01-29 14:54:46 +02:00
Pasi Kallinen
5829863be2 petattr also accepts italic 2024-01-28 19:03:45 +02:00
Pasi Kallinen
f6fae82633 Remove leftover curses extern definitions 2024-01-28 12:00:22 +02:00
PatR
57c8ae4b9a add NONNULLARG6
Incorporate some inconsequential bits from the testing I've been doing.
2024-01-28 01:13:08 -08:00
Pasi Kallinen
fd8b2b58d1 petattr: Change accepted parameters, add support for tty 2024-01-28 10:05:42 +02:00
nhmall
bac8ebad34 revisit Makefile sysconf steps
Add distinct potential steps into Makefile.top for putting
sysconf into place, instead of appending the steps for doing so
to the generic POSTINSTALL.

SYSCONFINSTALL is used for 'make install' and unconditionally
copies sys/unix/sysconf to the install directory.

SYSCONFENSURE is used for 'make update' and only copies
sys/unix/sysconf to the installation directory if it doesn't
already exist.

The initial trigger for revisiting this was because of new reports
that cp from (GNU coreutils) 9.4 is now issuing a warning during
NetHack builds. The warning pertains to deprecated use of the '-n'
switch with cp, which is used to only copy the file if the target
does not exist.

After this update, the shell is used to make that determination,
and if the file doesn't exist, cp is now invoked on Linux without
the '-n' switch.

For the macOS hints file, macOS.370, cp wasn't being used for sysconf
anyway, a utility script was being invoked and this doesn't change
that. macOS.370 was updated to remain in sync with linux.370 and
Makefile.top regarding the use of SYSCONFINSTALL and SYSCONFENSURE.
2024-01-27 18:12:18 -05:00
Pasi Kallinen
c497c14fda Split discovered sort and output lines 2024-01-27 19:47:42 +02:00
PatR
107c17efc4 yet another comment typo 2024-01-26 14:52:31 -08:00
PatR
9993fa97ec vision vs gas cloud dissipation
Reported directly to dev-team:  vapor cloud dissipation didn't always
update vision properly.

Region removal affecting visibility needs to make two passes, the
first unblocking all no longer blocked spots, then the second deciding
whether spots are visible.

Attempting to do that in one pass was doing
| unblock <x1,y1>
| if cansee <x1,y1> whatever
| unblock <x2,y2>
| if cansee <x2,y2> whatever
and the cansee <x1,y1> test wasn't accurate if <x2,y2> blocked it and
hadn't been unblocked yet.

Testing with steam didn't seem to trigger the problem but with poison
vapor trail from green dragon breath did.  The order of evaporation
mattered too; sometimes the single pass unblocking plus vision-testing
worked ok by coincidence.
2024-01-26 13:40:34 -08:00
PatR
524ae27c99 fake trap deaths
Eliminate the 'goto' for human corpse added a day or two ago.

If a dead gnome is generated with a candle, light it if/when the spot
is dark.  (Testing never managed to verify that this works as intended.)

mkcorpstat() never returns Null.
2024-01-26 12:52:52 -08:00
PatR
1bfde1eb6a itermonarr comments
Fix several typos/thinkos about 'itermonsiz' and remove an obsolete
remark about 'monarr'.
2024-01-26 11:57:01 -08:00
Pasi Kallinen
39fb072a92 Simplify rhack and parse
AFAICT, we only used the first char of the "command_line" string.
Just turn it into int to hold the key the main input loop parse() got.

Shouldn't have any functional difference.
2024-01-26 15:19:24 +02:00
PatR
17414c500a more monster iteration
Re-use the array allocated for iterating over all monsters during
monster movement much of the time.  It was being allocated from
scratch for each round of monster movement, then freed after they
moved, then repeated the next round.
2024-01-25 23:59:32 -08:00
PatR
9cd1a571ae more weight tweaks
Update some potential weight issues.  Eggs won't hatch when in
containers so they weren't affected but add some bulletproofing.
Corpse revival from inside containers was already ok too, so
effectively there's no change except for making container_weight() be
global instead of local to mkobj.c.
2024-01-25 23:09:12 -08:00
PatR
ec4691a859 fewer human corpses
When a low-level trap is created with a dead pseudo-adventurer,
usually make a player monster when the human case gets picked.

They have default level and no inventory.  They should probably be
given montraits that force low level but this doesn't do that.
2024-01-25 14:12:05 -08:00
nhmall
fa672fa1ba some utf8map corrections
Correct a color value and remove an unnecessary variable
2024-01-25 16:45:58 -05:00
PatR
4512e85e58 fix hero Strength
The recent acurr() changes introduced a bug that caused Str less
than 25 to be limited to 18/07.  25 was treated correctly as a
special case but 18/01 through 18/100 and 19 through 24 were not.
The cap of 25 imposed on the other characteristics is the same as
encoded Str 18/07.
2024-01-25 13:17:23 -08:00
PatR
500cbb0b11 comment typo 2024-01-25 12:20:00 -08:00
PatR
1c08982d56 Strlen_()
Restore its ability to reject a string longer than will fit within
size_t that was lost by moving away from strnlen().  Determine the
length inline rather than using strlen().

Move it from hacklib.c to alloc.c so that utility programs have easy
access, and remove the copy of it from dlb_main.c.

Fix a logic bug in str_start_is().  If a string was considered to
be too long, it exited the loop when n was 0 but also performed
post-decrement.  So after the loop, n would be -1 and the 'if (n==0)'
test would fail.  panic() would occur if the initial string matched
and happened to be LARGEST_INT-1 characters long.
2024-01-25 12:16:39 -08:00
Pasi Kallinen
47fa2eb000 Split kicking non-door terrain out of dokick 2024-01-25 21:43:55 +02:00
PatR
4be4f55ccf some reformatting for utf8map.c
and a few omitted 'const's for some constant pointers to constant
characters.

utf8map.c is missing date, branch, and revision tags on its first line.
2024-01-25 11:22:01 -08:00
Pasi Kallinen
cc599cb6cd Split up doengrave
doengrave was the largest function by far, so split it up into smaller
ones.  Use a structure to hold the dozens of variables needed all over it.
Should have no difference in behaviour, but I haven't tested everything.
2024-01-25 18:32:05 +02:00
nhmall
8aadfd794c comment updates
The comments referred to the function pointer variable before those
changed names, so this assumes that they still should.
2024-01-24 18:51:12 -05:00
PatR
de5864b7b4 comment typo 2024-01-24 14:56:21 -08:00
PatR
90d515b6ab fix #K4091 - losexp() assert(u.ulevel < 30) fail
Previously reported via github pull request #1188 as an out of bounds
access to u.uhpinc[], followed by issue #1189 when it was closed, the
backtrace accompanying new assertion failure provided more information
that led to figuring out the problem.

Only mattered for the debug fuzzer; wouldn't happen in regular play.

When the hero dies during fuzzing, the fuzzer sometimes restores lost
levels via blessed potion of restore ability.  If that happened to a
hero who died by being life-drained while at level 1 then losexp()'s
assumption that life-saved hero was still level 1 got violated.  If
levels had been lost all the way down from a peak of 30, restoration
to u.ulevel==30 resulted in invalid array indexing into u.uhpinc[],
then failure of 'assert(u.ulevel >= 0 && u.ulevel < MAXULEV)' which
was added to avoid that.

Pull request #1188 and issue #1189 are already closed, but they hadn't
actually been solved yet.

Fixes #1188
Fixes #1189
2024-01-24 14:31:26 -08:00
Pasi Kallinen
c2ddd2a7c2 Fix some object weight problems
There were few places where the object weight was not updated:

- container when the contents were broken by impact
- starting to eat but getting stopped by rotten food
- using lua, container when putting an object inside it
- when a single egg of a larger stack hatched
2024-01-24 17:58:54 +02:00
Pasi Kallinen
cd74a2a99e Fix Juiblex attacking without knowing your location
Juiblex could expel the hero over water, they'd get relocated to
a safe location, but Juiblex was still thinking they were at
the location it expelled them.
2024-01-24 17:50:04 +02:00
PatR
576dd10bdd fix #K4088 and #K4089 - ring formatting
+/-N for charged rings with known enchantment was clobbering the
BUC formatting that had occurred earlier.  #K4088 thought it was a
problem with the implicit_cursed option; followup #K4089 from same
user correctly pointed out that the problem was present for any BUC
state.

This is the same line of code that inadvertently omitted the space
between +/-N and "ring of <type>".  That was fixed by commit
1a2b2a8cae a couple of days ago.

While in doname(), fix a potential issue calling corpse_xname().
That assigns a new value to gx.xnamep, clobbering the value that
doname() relied on when it was first called (but doesn't look at
again, so doesn't matter now but could conceivably in the future).
2024-01-24 00:37:09 -08:00
PatR
ab4991930a alloc(0)
Have alloc() treat a request for 0 bytes as if it was one for
'sizeof (long)' bytes so that the issue of malloc(0) maybe yielding
NULL becomes moot.

I think instances of attempting to allocate 0 bytes should probably
still be checked for and made to avoid calling alloc(0).  Assuming
that alloc() will clean up requests for nothing feels sloppy.
2024-01-23 23:56:29 -08:00
PatR
78252de3bc fix memory leak in iter_mons_safe()
While hunting for a memory leak in object allocation--which I haven't
found yet--I discovered one in monster movement.  iter_mons_safe()
allocates an array of (monst *) pointers for the monsters on the
current level, loops over that array to call a function for each
one, then frees the array.  But if the game ends while that called
function is running, execution never returns to iter_mons_safe() so
it wasn't able to free the memory.

Since that can happen at most once per game, it wasn't a signifcant
leak.  This fixes it anyway.

There was a second issue:  make sure that iter_mons_safe() doesn't
call alloc(0) to make the temporary array for zero monsters when
there aren't any on the level.  That might not be able to happen for
monster movement but the routine is written to be more general than
just movement.  alloc(0) could confuse the MONITOR_HEAP code.  In
C89/C90 I think malloc(0) is allowed to return NULL (don't recall
for sure; maybe that was just known pre-standard behavior for some
implementations).  Null return would trigger a panic even without
MONITOR_HEAP.  Don't know about C99 and later.
2024-01-23 23:04:06 -08:00
PatR
1d165f20ee supply_chest fix fix
Reordering some tests to put the cheapest one first accidentally
removed a negation, unintentionally changing the semantics.
2024-01-23 16:52:39 -08:00
nhmall
ebd09e94f6 nonnull update for m_harmless_trap()
Both arguments are immediately dereferenced.
2024-01-23 18:50:35 -05:00
PatR
267daeaa0f supply chest fixes for "odd encumbrance behavior"
Changing the quantity to 2 (50:50 chance) when creating a potion of
healing (also 50:50 chance for each attempt) to place inside a supply
chest wasn't updating the potion stack's weight, resulting in the odd
encumbrance behavior that was reported last December.

Taking the stack out of the container doesn't fix the weight but
drinking one of the potions splits the stack of 2 into two stacks
of 1 and does update the weight for both.  That gives the hero higher
encumbrance when the formerly weightless one has its proper weight.
Finishing drinking the potion uses it up, removing second potion's
weight again.  When below an encumbrance threshold by the weight of
one potion or less, player will see encumbrance increase and then
decrease, with healing message given before both due to sequencing.

Supply chests weren't having their own weight updated when they were
populated, so would behave as if empty if hero carried them around.
Removing something, breaking something by kicking the chest, or adding
something would update its weight to match its contents.

I also noticed a refutation (or should that be rebuttable?) to my own
remarks in this:

| commit cd91d0630b
| Author: PatR <rankin@nethack.org>
| Date:   Sat Dec 30 17:10:39 2023 -0800
|
| github issue #1180 - humans and murder
|
| Issue reported by Umbire:  reviving a human corpse into a human
| monster and then killing it entails murder penalty even when it is
| hostile.
|
| This is probably a non-issue.  Human monsters tend to not leave
| human corpses, they leave shopkeeper corpses or sergeant corpses
[...]

Dead fake hero corpses placed at trap locations on early levels are
leaving plain human|dwarf|elf|gnome|orc corpses rather than fake
player monster ones (which are always human but resurrect as player
monsters rather than as plain humans), so there are more plain human
corpses now than there were in 3.6.x or early to-be-3.7.  I've added
a comment about the situation.
2024-01-23 15:42:19 -08:00
Pasi Kallinen
829f9f65f7 Split out harmless-to-monster trap
Also make the code much easier to understand, and
more-or-less match hero trap triggering.
2024-01-23 19:01:34 +02:00
Pasi Kallinen
7fa74d0199 Add LAVAWALL to linedup blocking 2024-01-23 18:37:16 +02:00
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