Commit Graph

17335 Commits

Author SHA1 Message Date
nhmall
079da0fcba update Files 2024-11-30 19:38:44 -05:00
nhmall
c2c2e84485 remove some tabs that snuck in unintentionally 2024-11-30 19:35:25 -05:00
nhmall
cd032881ad Windows pdcurses: suppress fallthrough warnings
Avoid warning about issues in 3rd party code
2024-11-30 19:19:54 -05:00
nhmall
b89e792873 Some Windows gcc fixes 2024-11-30 19:06:05 -05:00
nhmall
bc88266081 NetHack's regex function prototypes into nhregex.h
There was an issue with Windows mingw build because the function
prototypes were not available. Place them into a distinct
header file nhregex.h and include it from extern.h, and
available for cppregex.cpp to include without the rest of
extern.h (which can give some problems with c++).
2024-11-30 17:08:54 -05:00
nhmall
8f2b979f32 Windows: nmake lualib build bit 2024-11-30 17:05:23 -05:00
nhmall
f8d9b288b9 Merge branch 'NetHack-3.7' of https://github.com/guillaumebrunerie/NetHack into NetHack-3.7 2024-11-30 15:54:21 -05:00
nhmall
df86614318 Windows Visual Studio: another follow-up
Missed a couple of configuration options in previous fix
2024-11-30 15:51:30 -05:00
nhmall
36227fcb6d follow-up: build fix when using VS 2019 2024-11-30 15:47:40 -05:00
nhmall
d94f728a9f Windows visual studio: lualib as separate entity 2024-11-30 15:42:06 -05:00
nhmall
88301902f8 remove a left-over piece of a test 2024-11-30 14:47:04 -05:00
nhmall
0792e5fe9e expand implicit fallthrough detection to non-gcc compilers
gcc has recognized various "magic comments" for white-listing
occurrences of implicit fallthrough in switch statements for
a long time:

    The range and shape of "falls through" comments accepted are
    contingent upon the level of the warning. (The default level is =3.)

    -Wimplicit-fallthrough=0 disables the warning altogether.
    -Wimplicit-fallthrough=1 treats any kind of comment as a "falls through" comment.
    -Wimplicit-fallthrough=2 essentially accepts any comment that contains something
     that matches (case insensitively) "falls?[ \t-]*thr(ough|u)" regular expression.
    -Wimplicit-fallthrough=3 case sensitively matches a wide range of regular
     expressions, listed in the GCC manual. E.g., all of these are accepted:
        /* Falls through. */
        /* fall-thru */
        /* Else falls through. */
        /* FALLTHRU */
        /* ... falls through ... */
       etc.
    -Wimplicit-fallthrough=4 also, case sensitively matches a range of regular
     expressions but is much more strict than level =3.
    -Wimplicit-fallthrough=5 doesn't recognize any comments.

Plenty of other compilers did not recognize the gcc comment convention,
and up until now the compiler warning for detecting unintended
fallthrough had to be suppressed on other compilers. That's because the code
in NetHack has been relying on the gcc approach, and only the gcc approach.

The C23 standard introduces an attribute [[fallthrough]] for the
functionality, when implicit fallthrough warnings have been enabled.

Several popular compilers already support that, or a very similar attribute
style approach, today, even ahead of their C23 support:

       C compiler                       whitelist approach
       ---------------------------   -------------------------------------
       C23 conforming compilers         [[fallthrough]]

       clang versions supporting
       standards prior to
       C23                              __attribute__((__fallthrough__))

       Microsoft Visual Studio
       since VS 2022 17.4.
       The warning C5262 controls
       whether the implict
       fallthrough is detected and
       warned about with
       /std:clatest.                    [[fallthrough]]

This adds support to NetHack for the attribute approach by inserting a
macro FALLTHROUGH to the existing cases that require white-listing, so
other compilers can analyze things too.

The definition of the FALLTHROUGH macro is controlled in include/tradstdc.h.

The gcc comment approach has also been left in place at this time.
2024-11-30 14:16:27 -05:00
nhmall
d6beba7b6a Windows: fix hacklib subproject settings in VS 2024-11-30 11:57:20 -05:00
Guillaume Brunerie
52876c4798 WASM fixes 2024-11-30 17:07:10 +01:00
PatR
149cb96020 github issue #1299 - sleeping mimics
Issue reported by elunna:  sleeping mimics can grab the hero, and
zapping a concealed mimic with a wand of sleep describes the target
as a mimic but doesn't bring it out of concealment.

The grab-when-asleep case is reasonable.  It's a reflexive counter-
attack by a magical creature.  And the mimic wakes up in the process.
But the mimic wasn't being brought out of concealment.  Do that.

Unconceal mimics hit by wand of sleep unless already sleeping.

Fixes #1299
2024-11-29 23:30:04 -08:00
PatR
689f6c4c82 prayer lint 2024-11-28 14:24:27 -08:00
PatR
cbc93a0555 github issue #1312 - prot from shape changers
Issue reported by youkan700:  shape change anomalies.  Shapechangers
could change shape despite active protection-from-shape-changers if
hero wore two rings of protection from shape changers and took one
off.  Shapechangers who migrated to a not-yet-visited level that
eventually got visited with protection from shape changers in effect
would be stuck in their current shape, even if the PfSC attribute
got toggled off and back on.

The issue included suggested fixes and those are what I've used.  I
noticed a third case that only applies to wizard mode:  if player
used #wizintrinsic to set a timed value for PfSC, monsters wouldn't
resume changing shape after it timed out, unless/until it got toggled
on and back off via a PfSC ring or hero left the level and returned.

Fixes #1312
2024-11-28 11:33:26 -08:00
nhkeni
755b70de69 Make documentation of nhgitset.pl easier to find and
find out about.
2024-11-27 14:06:27 -05:00
PatR
c255dc4bc4 paranoid_confirm:trap when flying or levitating
Avoid asking the player whether to _step_ on a trap when flying or
levitating.  locomotion() isn't the right routine for handling that.
2024-11-27 10:37:55 -08:00
PatR
5c0834e9d9 hurtle_step() streamlining
Eliminate some code duplication in hurtling.
2024-11-27 10:32:09 -08:00
PatR
9c0e47785a digging in ice
If the spot in front of a closed drawbridge was ICE, digging there
had issues....
2024-11-27 08:41:55 -08:00
nhmall
c1c74db90c update tested versions of Visual Studio 2024-11-27 2024-11-27 09:48:35 -05:00
PatR
1fe23ff4d9 vampshifters vs closed doors
If a vampire in fog cloud form moves under a closed door and then
before moving further gets killed and revives in vampire form,
destroy the door instead of moving the vampire to a nearby open
spot (which might be a distant spot if the map is crowded).  If the
door is trapped, explode the trap.  That will damage the vampire but
usually not by enough to kill it.

This probably ought to be generalized to be done for any shape change
at a closed location but I ran out of gas.
2024-11-26 22:15:41 -08:00
PatR
6a6378d886 some termcap.c bits
Clear out the tempcap.c portion of an old stash entry.  Only the
combination of conditionals used for OSX has been exercised.
2024-11-26 22:12:05 -08:00
PatR
dab4784842 Unix 'make spotless' - remove lev_comp + dgn_comp
In case someone switches from NetHack-3.6 to NetHack-3.7 and does
'make spotless' after the switch instead of before, get rid of out
of date lev_comp and dgn_comp.
2024-11-26 21:52:47 -08:00
PatR
1c888b3b07 noit_mon_nam()
Change noit_mon_nam() to work as if it was noit_y_monnam() (without
renaming it or adding yet another monster naming routine) to use
"your <mon>" rather than "the <mon>" when <mon> is a pet that can
be seen (so not the case where "it" gets replaced by "someone" or
"something").
2024-11-26 21:51:00 -08:00
PatR
1d0b8dfca0 Demonbane revisited
Commit c4a1f298e8 two and a half
months ago gave lawful Angels and Archons a chance to start with
a mace instead of a long sword so that they might get Demonbane.
It was a bit convulted; this redoes it to be more straightforward.
2024-11-26 21:40:19 -08:00
nhmall
70284521e6 follow-up: paste bit 2024-11-27 00:35:27 -05:00
PatR
ea6cdd3f39 Amulet_on() & Amulet_off()
Fix a FIXME in Amulet_off() for removing an amulet of magical
breathing when within a poison gas cloud.

Redo message sequencing for both Amulet_on() and Amulet_off().

Use up an amulet of change if put on while the Unchanging attribute
is active (via #wizintrinsic) instead of wearing it with no effect.

Don't discover amulet of strangulation if put on while already
Strangled (via #wizintrinsic).
2024-11-26 21:20:30 -08:00
PatR
d32ab55b84 new property: BLND_RES
Add enlightenment feedback for Sunsword's blocking of becoming blind
from light flashes.  It uses an extra property so that wizard mode
can report the reason.

EDITLEVEL is being incremented, so existing save and bones files are
invalidated.
2024-11-26 20:57:11 -08:00
nhmall
15e70035d0 Remove unnecessary macro that wasn't ideally named
Also add a comment that states the intent.
2024-11-26 23:27:29 -05:00
PatR
3615b17b62 'O' feedback when toggling 'accessiblemsg'
When accessiblemsg is Off, coordiates supplied for various messages
stayed put after becoming stale.  If you used 'mO' to toggle that
option On, you could see things like
 (2east):'accessiblemsg' option toggled on.
After that, accessibility message coordinates behaved as intended.

Clear a11y.msg_loc.x,y for every pline instead of just when they
are used to augment the current message.

Most players who use accessiblemsg are bound to set it in their
config file rather than toggle it interactively so never noticed.

Misc 1:  option.c doesn't need '#include <ctype.h>' because
cstd.h includes it unconditionally.  Several other src/*.c are in
the same situation but I didn't touch them.

Misc 2:  move set_msg_dir() and set_msg_xy() out of a warning
suppression block that isn't relevant to them.
2024-11-26 19:28:30 -08:00
PatR
1c5b295097 tin consumption edge cases
If eating a tin killed the hero (choked, turned to stone, poly'd into
a new man with new Xp too low to survive) and bones were saved, the
tin remained intact in them.

When hero who is poly'd into metallivore form eats a tin, give a
little extra nutrition for the tin itself.  Also, eat it immediately
by skipping the "It smells like <creature>" message and "Eat it? [yn]"
prompt.  (The message while eating it also reports <creature>, so
skipping the 'smells' one doesn't end up hiding anything.)
2024-11-26 18:01:19 -08:00
Anhijkt
d93704a154 change CHDIR definition conditions 2024-11-23 19:04:12 +02:00
nhmall
37793be6eb more quieting of Qt6 build warnings 2024-11-20 09:56:01 -05:00
nhmall
3e903fd79a quiet warnings on recent Qt, macOS Sequoia 15.1, latest Xcode 2024-11-17 10:03:04 -05:00
nhkeni
4f3c463d69 remove some testing junk that escaped 2024-11-16 17:39:40 -05:00
nhmall
7932497450 follow-up for Makefile.nmake 2024-11-16 10:45:22 -05:00
nhmall
21b495f835 Makefile.nmake build fix when no curses options
Resolves #1325
2024-11-16 10:10:10 -05:00
nhkeni
d493d31aec Remove "*.txt NHSUBST" from .gitattributes because it's too general.
Specifically, it was marking Guidebook.txt for substitution, but
it's a derived file, not a source.
2024-11-15 19:00:31 -05:00
SHIRAKATA Kentaro
aba2bda159 split eval_offering() into a separate function 2024-11-16 04:10:11 +09:00
nhmall
13db1aed0d replace stray tabs that have crept in 2024-11-14 11:54:39 -05:00
Pasi Kallinen
62971c6f09 Qt: add support for the palette config option
Depends on CHANGE_COLOR compile-time option.
2024-11-14 17:25:44 +02:00
nhmall
c7591c0e08 remove redundant zeroing 2024-11-13 17:36:47 -05:00
nhmall
b8083733de some sys.c orphaned pointer prevention 2024-11-13 17:14:47 -05:00
nhmall
7ff17845c6 Windows MSYS2 build fix 2024-11-13 16:14:49 -05:00
nhmall
c16c87a897 Merge branch 'early_return' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-13 14:54:34 -05:00
nhmall
52a9af7278 early_init() was being called twice on Windows GUI 2024-11-13 13:57:18 -05:00
nhmall
fa9210aa65 Windows: free more allocated memory before exit
This gets rid of the final leak complaint on Windows as of Nov 13, 2024
2024-11-13 13:48:50 -05:00
nhmall
c85b5d3e56 rearrange function layout in Windows windmain.c 2024-11-13 13:48:03 -05:00