Commit Graph

17664 Commits

Author SHA1 Message Date
nhmall
f1be2eaffa add --dumpmongen to view mongen_order[] array 2025-02-14 09:38:29 -05:00
Pasi Kallinen
027bf78f28 Sort monsters for mkclass
An assumption of monster generating code is that monsters within a class
appear in increasing order of difficulty.  This wasn't the case with
some monsters, but swapping the monsters around is rather intrusive,
and doesn't really lend to changing monster difficulties when needed.

As a result, for example ghouls would not randomly generate when they
should have at certain level difficulties (where a ghoul is weak enough
to generate but an ettin zombie would be too strong).

Keep a separate array of monster indexes sorted correctly, generate it
when required by mkclass()

Description of this bug via copperwater <aosdict@gmail.com>
2025-02-13 17:17:00 +02:00
nhmall
e26102f66d leashed food ration fix
Noticed while testing an earlier fix - after your pet consumes a large mimic
corpse don't have it remain leashed once it begins to mimic something
that isn't leashable
2025-02-13 00:18:39 -05:00
nhmall
a68bc3b3fb fix tamed pet issue #1379
fixes #1379
2025-02-12 23:26:03 -05:00
nhmall
f8773f65db update tested versions of Visual Studio 2025-02-11 2025-02-11 19:50:08 -05:00
nhmall
907c0fbece follow-up: put back a comment that got removed 2025-02-11 09:29:32 -05:00
nhmall
563340093c stop keeping 5 arrays in sync in dumpenums code 2025-02-11 08:50:30 -05:00
nhmall
1317c850b3 fix output of --dumpenums 2025-02-11 08:02:10 -05:00
Pasi Kallinen
d1f0cfce92 No hangup save while in tutorial
Tutorial code doesn't handle saving and reloading the game gracefully,
and manually saving has been disabled in there already.
Also disable automatic saving in the tutorial when the terminal goes away.
2025-02-10 17:48:01 +02:00
nhmall
10e5d2121c fix typo reported in b9ff8068 from Sept 2024 2025-02-09 10:52:21 -05:00
copperwater
6c9d4df4a6 Fix: gremlin cry of pain could be heard while deaf
Main problem was there was no condition applied to this message, so
anyone would hear it even if they were deaf. Even assuming a cry of pain
is something that could be seen, the message was still printed when the
hero couldn't see the gremlin.

This puts both a deafness check and a range check on that cry (if a
gremlin somehow takes light damage on the other side of the map behind
many walls, it doesn't make much sense to hear its cry), and provides an
alternate message if the hero can't hear it, but can see it. The
alternate message does rely on the hero being able to /see/, not just
spot, the gremlin and the light it's shying away from -- if you can only
sense it, there is no special message.
2025-02-09 14:01:05 +02:00
copperwater
f228a790b0 Clean up hardcoded material constant in water vault themerm
This implements a TODO to return an object's material as text rather
than as an int when a Lua file requests all the details about an
object's objclass. That is as simple as looking it up in materialnm[].

With that done, it's possible to clean up the one use where a Lua file
looks up the material of an object it generated, in the
"water-surrounded vault" themed room, previously an inflexible 19 but
which can now be compared directly to "glass". It also enables
shortening the comments that follow since the branches of the if
statement are now obvious.
2025-02-09 13:57:25 +02:00
nhkeni
e358f37863 Merge remote-tracking branch 'origin/keni-fetchdocs' into NetHack-3.7 2025-02-07 15:36:19 -05:00
nhmall
fe4cb7a626 make rank() static again 2025-02-05 20:03:06 -05:00
nhmall
c1516666b3 ebones follow-up fix #1 2025-02-05 17:26:15 -05:00
nhmall
c9729bf838 one more follow-up 2025-02-05 08:18:29 -05:00
nhmall
a065ced14a follow-up for gw.were_changes 2025-02-05 08:13:35 -05:00
nhmall
0d543a8fae remove a set_uasmon() call from iter_mons() processing
Reported by hackemslashem.
2025-02-05 07:57:25 -05:00
PatR
d611da42cc enlightenment for armor's effect on spell casting
Report the effect of suit and/or robe on spell casting during
attribute enlightenment.

Doesn't attempt to include other armor slots.  That's complicated
and would end up being too verbose.
2025-02-05 00:01:07 -08:00
nhmall
88107193db another follow-up, in commented-out code 2025-02-04 15:36:36 -05:00
nhmall
6c0e755573 follow-up for ebones 2025-02-04 15:33:38 -05:00
nhmall
33954f7973 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2025-02-04 15:19:51 -05:00
nhmall
c24786430f 'struct former' -> 'struct ebones'
Some variants were already using a similar approach
using a struct called 'ebones', so adopt the same naming
so NetHack-3.7, hardfought, and some variants are using
the same name.

As before there are fields in the struct that are not
currently used by NetHack-3.7, but the intent is that
hardfought save and bones files can be loaded by
NetHack-3.7 without code modification, for debugging
bug reports.

This invalidates existing save and bones files.
2025-02-04 15:16:42 -05:00
PatR
3d02eb45d3 resistance checking again
Another attempt to straighten out resistance checking....
2025-02-04 11:06:53 -08:00
PatR
b44a547153 fix resistance breakage
The Mitre of Holiness commit broke resistance handling.  This seems
to work correctly.
2025-02-03 23:20:07 -08:00
PatR
a311f4b467 fix issue #1362 - carrying Mitre of Holiness
Issue reported by elunna:  the definition of the Mitre of Holiness
specifies that carrying it should confer fire resistance but that
didn't work.

The Mitre's definition (added in 3.1.0) has always included that,
but such a capability had never been implemented.  Wearing it didn't
confer fire resistance either--its definition doesn't bother to
specify a 'defend' attribute since the 'carry' one should cover that.

This adds carrying capability for damage types fire, cold, sleep,
disintegration, electrity, poison, acid, and petrification.  Fire is
still specified by the Mitre; none of the others are currently used.

Fixes #1362
2025-02-03 11:42:36 -08:00
nhmall
785f78c39b avoid "You fall down a deep shaft!" if flying down
Fixes #1371
2025-02-03 00:53:06 -05:00
nhmall
d65d0062a9 follow-up: evolve placeholder content to match variant
suggestion by paxed

Increments EDITLEVEL again.
2025-02-02 12:53:58 -05:00
nhmall
d331029b03 more clobber-detection 2025-02-02 09:08:48 -05:00
nhmall
bda3437eab bump EDITLEVEL 2025-02-02 09:00:21 -05:00
nhmall
d785f7a649 add two unused fields for hardfought save compatability
There are two hardfought code additions that render save and bones files incompatible
with the upstream NetHack-3.7, and that makes testing with hardfought
save and bones files more challenging than it needs to be, when
investigating and troubleshooting bug reports.

Add some unused fields to advance towards achieving save file parity with
hardfought, which is a significant source of play-testing for NetHack-3.7.

1) the elbereth field addition to u_conduct

This adds an unused placeholder field named 'hf_reserved1', at the appropriate
place in u_conduct to achieve struct field parity with the one in use on
hardfought.

2) hardfought adds a field to struct monst:
    char former_rank[25]; /* for bones' ghost rank in their former life */

Instead of adding that to every monst, this adds a new mextra struct
named 'former', which currently contains the equivalent 25-character
field called 'rank' which can hold the content that was in the
former_rank[25] field. That way, the field will only be added when it
is needed.

A pull request https://github.com/k21971/NetHack37/pull/2 has been
done on hardfought to do it the same way (untested there as of yet).

Even though NetHack-3.7 does not utilize that information presently,
this will be a further step toward allowing hardfought-generated save
and bones files to be used for troubleshooting, without modification,
on a similar architecture running stock NetHack-3.7 code.

That savefile parity won't be achieved until the after the
hardfought pull-request mentioned above (or equivalent) is merged.

As this change will not be compatible with existing save and bones
files, it will be accompanied with an EDITLEVEL increment.
2025-02-02 09:00:05 -05:00
nhmall
d74624abbd add mexta field to simplify detection of overwrite
Because this invalidates existing save and bones files,
an increment of EDITLEVEL will accompany this.
2025-02-02 08:30:48 -05:00
nhmall
6431f4727c comment instructions in mextra.h updated 2025-02-01 14:09:58 -05:00
nhkeni
cfe39900ca Demo for downloading formatted docs
Written for MacOS, more useful for Windows (but I'm not writing that).
2025-01-31 21:48:15 -05:00
Pasi Kallinen
3ffbfc724c Fix another impossible no_charge object
Tame earth elemental picked up a no_charge object from a shop and moved
it out of the shop, causing "no_charge obj not inside tended shop"
impossible.  Non-tame monsters picking up no_charge items cleared that
bit, so make the same happen for pets.
2025-01-28 21:26:10 +02:00
nhmall
7ff7679a76 remove a redundant check for NULL
mksobj is declared to have a NONNULL return:
extern struct obj *mksobj(int, boolean, boolean) NONNULL;

Remove an unnecessary if block.
2025-01-27 10:12:10 -05:00
PatR
b6eda14368 obj->tknown comments 2025-01-27 00:37:35 -08:00
nhmall
f75e4a13b7 more follow-up for mk_artifact() 2025-01-26 21:38:37 -05:00
nhmall
ee0d955050 follow-up: make definition match proto staticfn 2025-01-26 12:25:27 -05:00
nhmall
3cca4f2707 avoid mk_artifact()-related memory leaks
Reported directly to devteam after being discovered in nerfhack.
2025-01-26 11:57:01 -05:00
nhmall
ed44da351e more follow-up, less hiding of illegal values
Catch it prior to the rn2() call instead. We need to
be aware of the issue.
2025-01-24 18:26:56 -05:00
nhmall
dc938b7acf don't hide the zero value of apport
It was pointed out that it might not be a good idea to hide the illegal value of apport.
2025-01-24 18:24:26 -05:00
PatR
3c824cd866 fix incorrect lint fix
>  if (strlen(simpleoname) > BUFSZ - sizeof "the ")
>    simpleoname[sizeof "the "] = '\0';

The second line should have been
|    simpleoname[strlen(simpleoname) - sizeof "the "] = '\0';
but fixing that isn't adequate.  The BUFSZ limit is not valid when
dealing with object names since xname() leaves room for a prefix so
doesn't return the start of a BUFSZ-sized buffer.

Strangely enough, the complaint that caused me to add those two lines
isn't being triggered any more.  Some other change at the same time,
perhaps splitting
  Strcpy(simpleoname, obufp = the(simpleoname));
into
  obufp = the(simpleoname);
  Strcpy(simpleoname, obufp);
pacified the analyzer.  However, it didn't resolve the valid complaint
that inserting "the " might result in overflow.

I've added a comment about simpleonames(), ansimpleoname(), and
thesimpleoname() about the possible overflow, but I don't think that
such overflow can actually happen when user-applied object name is
being suppressed.
2025-01-24 14:50:53 -08:00
nhmall
02102de396 attempt to resolve issue #1368
Resolve #1368
2025-01-24 17:06:17 -05:00
Pasi Kallinen
c9abc92dd7 Fix lua.adoc 2025-01-24 19:04:17 +02:00
nhkeni
9313e819de nhgitset.pl: leftover tid 2025-01-24 10:57:40 -05:00
PatR
858bf3b30d analysis lint for tilemap.c 2025-01-23 20:15:40 -08:00
PatR
6ac0be46f6 last analyzer bit for win/curses/cursmesg.c
I got confused and thought that this one (actually pair) was more
complicated than it actually is.  have_mixed_leadin is used in an
ordinary way, but resetting it to false happens in spots where it
can't be used again.  The analyzer complains that the assignments
don't do anything useful.
2025-01-23 17:30:27 -08:00
nhmall
349f3871be preproc fix 2025-01-23 19:37:19 -05:00
PatR
150b331189 analyzer lint for win/curses/*.c
There is still an issue in cursmesg.c.

The last diff band (curses_putch) isn't related to static analysis.
2025-01-23 13:52:19 -08:00