Commit Graph

17270 Commits

Author SHA1 Message Date
nhmall
bbcd161e5f follow-up: prompt message bit 2024-11-10 10:19:58 -05:00
nhmall
c87a373b11 more follow-up related to #1320 2024-11-10 10:06:07 -05:00
nhmall
5cc529efc8 follow-up related to #1320
This is additional groundwork related to
https://github.com/NetHack/NetHack/issues/1320

This additional groundwork just puts some safeguards
in place to make it rather tough to end up with an
instant death from handling a cockatrice corpse in
your inventory without appropriate protection.

At this point, still no actual petrification will occur.
2024-11-09 23:49:10 -05:00
nhmall
a40d85a430 Merge branch 'offer_corpse' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-09 14:47:33 -05:00
nhmall
9c554895b1 adjust wish for cockatrice corpse
Wishing is powerful, so if you cannot safely handle a cockatrice
corpse, then have a wish for one result in the corpse materializing
on the floor rather than in your inventory.

Resolves #1320
2024-11-09 14:06:43 -05:00
nhmall
36d8998edb try not including trees when check_pos() returns it's 3rd argument.
Related to #1309
https://github.com/NetHack/NetHack/issues/1309

K2 commented: "This might help - k21971/EvilHack@afed641"

A comment in there states:
"Fix: sections of wall being visible when they shouldn't yet.
This has been a long-standing bug for as long as I can remember, and qt
appears to have figured it out. What was happening: the player would all
of the sudden see a section of wall in an area that they hadn't explored
yet. It was discovered that this was only occurring if that section of
wall had any type of tree up against it."

The fix there attempts to leave trees out of the check_pos non-zero return,
so give that a shot.

I didn't attempt to reproduce the situation myself,
and therefore cannot confirm that this does resolve it.

Feedback on effectiveness or side-effects are welcomed. If someone is
able to confirm that this resolves the issue without creating new
issues, we can close it, otherwise this can be reverted.
2024-11-09 11:40:09 -05:00
nhmall
1dbba0f63b rename IS_ROCK() macro to IS_OBSTRUCTED()
It has included trees since they were added, so give it a
more fitting name.
2024-11-09 11:12:42 -05:00
nhmall
f1743d0e5c more rm.h comment updates 2024-11-09 10:58:58 -05:00
nhmall
a74badd271 rm.h comment updates 2024-11-09 10:53:48 -05:00
SHIRAKATA Kentaro
db460a4fcf split offering a corpse into a separate function 2024-11-09 02:35:19 +09:00
nhmall
aaf324bcb4 comment bit in polyself.c 2024-11-07 16:29:45 -05:00
nhmall
9e75dec8f3 Merge branch 'negative_valued' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-07 10:37:38 -05:00
nhmall
e863583c56 iterating gi.invent (github issue #1315)
GitHub issue #1315 points out that it is possible for
a downstream function to change an object's nobj field
to point to a completely different chain.

The cited example by @vultur-cadens was:

     for (obj = gi.invent; obj; obj = obj->nobj)
         if (obj->oclass != COIN_CLASS && !obj->cursed && !rn2(5)) {
             curse(obj);
             ++buc_changed;
         }

    curse() drops the weapon with drop_uswapwep(),
        which calls dropx(),
            which calls dropy(),
                which calls dropz(),
                    which calls place_object().

place_object alters the nobj pointer, to point to the floor chain:
    otmp->nobj = fobj;
    fobj = otmp;

The result was that the next loop iteration was then using floor
objects from the floor chain.

This alters several for-loops to use a more consistent approach,
particularly when the obj is being handed off to a function,
where a downstream function might, or might not, alter the nobj
field.

References:

https://github.com/NetHack/NetHack/issues/1315
https://www.reddit.com/r/nethack/comments/1gkc9ub/even_if_you_drop_an_item_before_drinking_from_the/
2024-11-06 16:59:51 -05:00
SHIRAKATA Kentaro
ffe2dfc17c split offering negative valued items into a separate function 2024-11-07 03:30:13 +09:00
SHIRAKATA Kentaro
b953625e5b early return when value == 0 on dosacrifice()
`calc_value()` returns a non-negative value, and there is no code that sets `value` to 0 after this point.
2024-11-05 15:30:07 +09:00
SHIRAKATA Kentaro
955c2c5faf early return on dosacrifice()
... to reduce indents and prepare further refactorings.
2024-11-05 00:50:19 +09:00
nhmall
091a709cdb follow-up: NetHack typically passes ptr to coord 2024-11-03 09:21:19 -05:00
nhmall
82bca3d78a Merge branch 'use_leash' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-03 09:16:09 -05:00
nhmall
e4b334e8b9 Merge branch 'sacrifice_value' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-03 09:12:01 -05:00
nhmall
aba796bb08 Merge branch 'rock_disppear_msg' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-03 09:10:16 -05:00
nhmall
f46cd2732a W_NONDIGGABLE collisions with overloaded rm flags fields
Resolves #1308
2024-11-03 09:08:11 -05:00
nhmall
9a42d70901 ranged attack in repertoire might not be used
Commit 22884522, ported (from Sporkhack, Evilhack), added the ability
for monsters to maintain awareness of player resistances that they
observed.

Since they will refrain from using a ranged attack that they deem
futile, take the specific monster's seen_resistance field into consideration
when choosing code paths based on the availability of ranged attacks.

Resolves #1307
2024-11-03 09:03:04 -05:00
SHIRAKATA Kentaro
ce41d32c2c split "got_target" on use_leash() into a separate function 2024-11-03 03:06:17 +09:00
nhmall
70a5b06c45 Makefile.nmake fix for target spotless under x64 2024-11-02 09:15:20 -04:00
SHIRAKATA Kentaro
3f3e1cc49a split calculating sacrifice value into a separate function 2024-10-30 13:36:42 +09:00
nhmall
fec99bfb86 follow-up: parameter UNUSED as in most of NetHack 2024-10-29 19:30:09 -04:00
Mika Kuoppala
9294239197 util: match fopen_datafile function prototype
The prototype for fopen_datafile() is different if
it is used for util/dlb. Add the missing integer parameter.
2024-10-28 21:40:50 +02:00
SHIRAKATA Kentaro
bb401fcb38 split a message of a rock disappearing into a separate function
... to prepare further refactoring
2024-10-27 00:48:01 +09:00
Alex Smith
4c49239940 Update a comment in config.h to allow for gnome-terminal updates
gnome-terminal was recently fixed to work correctly with
TTY_TILES_ESCCODES (and other similar private-use terminal code
sequences), and thus this isn't an incompatible combination any
more.
2024-10-25 01:34:48 +01:00
nhmall
79c889502c follow-up: remove trailing whitespace 2024-10-24 08:40:44 -04:00
nhmall
f40c81d2fd Merge branch 'passiveum' of https://github.com/argrath/NetHack into NetHack-3.7 2024-10-24 08:39:09 -04:00
nhmall
2cf52c0374 Merge branch 'dopush' of https://github.com/argrath/NetHack into NetHack-3.7 2024-10-24 08:38:33 -04:00
nhmall
5eefeaf009 msghandler follow-up: msdos cross-compile warnings
pline.c: In function 'execplinehandler':
pline.c:631:17: warning: unused variable 'args' [-Wunused-variable]
  631 |     const char *args[3];
      |                 ^~~~
pline.c:626:30: warning: unused parameter 'line' [-Wunused-parameter]
  626 | execplinehandler(const char *line)
      |                  ~~~~~~~~~~~~^~~~
2024-10-19 08:02:03 -04:00
Pasi Kallinen
945ccff1ff Allow changing command autocompletions via #optionsfull 2024-10-19 14:46:11 +03:00
nhmall
64bb0e2144 msghandler follow-up: fix mingw/MSYS2 build 2024-10-19 07:28:12 -04:00
Pasi Kallinen
696af89299 Change MSGHANDLER from compile-time to sysconf 2024-10-19 10:47:53 +03:00
Pasi Kallinen
d35aa35c3f Don't put the unknown command message into history
Even with Norep, it was cluttering the message history buffer.
2024-10-18 17:54:05 +03:00
Pasi Kallinen
0530ca0758 Fix the undiggable/nonpasswall stuff
wall_info (aka flags) is overloaded with other stuff.
2024-10-18 16:52:29 +03:00
Pasi Kallinen
c33a6e7c0b Wizmode wishing for undiggable/unphaseable walls 2024-10-18 14:20:24 +03:00
Pasi Kallinen
f12635ccd9 Prevent monster generation in the sokoban trap hallway
Makes Sokoban far less tedious when you don't have to worry about
monsters randomly popping up in the trap hallway while you're pushing
the boulder.

Adds a new exclusion zone for monster generation, and the goodpos
routine avoids the zones when GP_AVOID_MONPOS is used.
2024-10-18 13:30:51 +03:00
Pasi Kallinen
9e4b2c121b Improve the exclusion zone code
I forgot to add the code to flip the exclusion zones when implementing them.
Also improve the zone coordinates so they're correct outside of map contents.
2024-10-17 12:34:06 +03:00
SHIRAKATA Kentaro
d2b7c2f5c5 split "assess_dmg" on passiveum() into a separate function 2024-10-15 03:21:08 +09:00
PatR
546c1101b0 more 'selectsaved'
If the saved game menu has more than 13 games, it won't be able to
use 'n' for "new game" and 'q' for "quit".  Switch to 'N' and 'Q'
instead of just using the next letters in sequence.  Only resort to
next-letters if there are more than 39 games.

tty and curses handle a list of many save files via menu pagination.
X11 does so with one long page possessing a scroll bar.  If there
are more than 52 entries, selection via mouse is needed beyond 'Z'.

Qt has one page without any scroll bar so won't provide access to
the full set of save files when there are too many to fit on the
screen.
2024-10-12 15:03:54 -07:00
PatR
35cf713988 fix part of #S11588 - mons eating poisoned items
Prevent non-poison resistant monsters that eat items from eating
poisoned items.
2024-10-12 14:39:48 -07:00
nhmall
3885949c5b resolve a static analyzer complaint in glyphs.c
src/glyphs.c(680): warning: Dereferencing NULL pointer.
                   'other' contains the same NULL value as 'obj_glyphs[idx].u' did.
2024-10-12 15:28:44 -04:00
nhmall
67cfdf6843 get rid of a static analyzer warning
src/pager.c(696): warning: Reading invalid data from 'def_warnsyms'
2024-10-12 14:56:36 -04:00
PatR
10498b1535 monster swapping armor simplification
Slightly simplify yesterday's message adjustment made when a monster
takes off a piece of armor and puts on a different instance of the
same type of armor.  ("a|an <something>" -> "another <something>")
2024-10-12 11:09:50 -07:00
nhmall
57fc8f10a6 replace fuzzer state magic numbers 2024-10-12 10:14:44 -04:00
nhmall
87af3a8cac fuzzer under Windows GUI hangs on minimize window
On the Windows GUI (nethackw.exe), while running the fuzzer,
if the NetHack window gets minimized, or someone minimizes all
desktop windows, the NetHack window stops responding and won't
even repaint itself. The NetHack process continues to use the
CPU.

A break in the debugger shows that it is caught in a do loop.

I didn't delve into the issue of why minimizing the window
triggers a condition that leads to the endless loop. This
just adds a kludge to exit the loop while fuzzing.
2024-10-12 09:28:29 -04:00
PatR
e1dbad9194 monster swapping armor
While testing the Demonbane change, I saw
| The Angel of Crom removes a robe and puts on a robe.

which looks a bit silly.  Change that to be
| The Angel of Crom removes a robe and puts on another robe.

when the two items have the same formatted description.  (The second
robe evidently has a better enchantment than the first one.)
2024-10-12 00:17:58 -07:00