Commit Graph

15330 Commits

Author SHA1 Message Date
nhmall
22d79e245d submodule update for pdcursesmod 2023-06-04 10:02:59 -04:00
PatR
ee27ec97d1 tutorial tweaks
Replace tests against tutorial_dnum with 'In_tutorial()' predicate.

Give a message when entering the tutorial (via level change mechanism).

Likewise, give a message when resuming regular play.

If player uses #quit or ^C in the tutorial, ask whether to cut the
tutorial short and resume regular play; skip "Really quit?" if the
answer is yes.  Behavior is a bit odd for ^C + yes; it just sits there
until player types something.
2023-06-04 00:22:14 -07:00
PatR
2bbfed2183 fix github issue #1046 - tutorial anomalies
Reported by Noisytoot:  going from level tut-1 to tut-2 returned the
hero's starting equipment too soon, and exiting the tutorial from
tut-2 let the hero keep any equipment acquired within the tutorial.

Entering and leaving the tutorial was being handled by lua code in
the level description of tut-1 and adding a second level messed that
up.  I didn't see any way of handing that with level-specific lua
code so I made it become the core's responsibility.  gotolevel()
knows when the hero is moving from one dungeon branch to another so
it can recognize entry to or exit from the tutorial easily.

While fixing this, prevent #invoke of the Eye of the Aethiopica from
offering the tutorial as a candidate destination (was feasible if it
had been entered at start of game).

Not fixed:  levels visited in the tutorial become part of #overview.

Show location as "Tutorial:1" instead of "Dlvl:1" on status lines.
Only tested with tty; some interfaces handle location themselves and
may need their own fixup for this.

Fixes #1046
2023-06-03 16:39:12 -07:00
PatR
4e32364313 fix #K3934 - curses menu bug when entering count
Entering a multi-digit count when selecting from a menu in the curses
interface causes the menu to disappear.  Report was about putting a
large subset of an object stack into a container but the bug affected
all menus that accepted counts.

curses_get_count() was changed to call core's get_count() quite a
while back.  get_count() calls mark_synch() when more that one digit
is typed or when backspace to remove the first digit occurs.
curses_mark_synch() had been a no-op but more recently it was changed
to try to make sure that the screen was up to date.  But it did that
by refreshing the persistent windows, making any temporary popup menu
or text window become hidden.  Also, the count-in-progress is being
sent to the message window with the no-history flag, so refreshing
the message window removed that too.

Switch curses_mark_synch() to use the basic screen refresh call that
doesn't do anything window-specific.  This also changes menu count
handling to have get_count() echo the number starting with the first
digit instead of waiting until the second.

If anything in the menu makes it be very wide it can cover up the
message window and any count being echoed there won't be visible.
I'm not going to try to figure out how to deal with that; it isn't
all that different from the old single-digit/unseen-count behavior.
2023-06-02 11:42:18 -07:00
nhmall
d74e84fb05 warning suppression
files.c: In function 'do_write_config_file':
files.c:2146:66: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
 2146 |             pline("An error occurred, wrote only partial data (%lu/%lu).",
      |                                                                ~~^
      |                                                                  |
      |                                                                  long unsigned int
      |                                                                %u
 2147 |                   wrote, len);
      |                   ~~~~~
      |                   |
      |                   size_t {aka unsigned int}
files.c:2146:70: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
 2146 |             pline("An error occurred, wrote only partial data (%lu/%lu).",
      |                                                                    ~~^
      |                                                                      |
      |                                                                      long unsigned int
      |                                                                    %u
 2147 |                   wrote, len);
      |                          ~~~
      |                          |
      |                          size_t {aka unsigned int}
2023-05-31 22:17:07 -04:00
PatR
ecd3593163 github pull request #1030 - VDECL
The pull request from argrath would have moved the definition of
VDECL from tradstdc.h to vmsconf.h because some out of date references
to it in sys/vms/*.c were the only place it still appeared to be used.
Instead of applying that, remove those old references.

NetHack 3.7.x requires C99 so just remove VDECL since it was present
in order to support pre-ANSI compilers.  (There is at least one
comment that still mentions it though.)

This also gets rid of another chunk of tradstdc.h that was allowing
either pre-ANSI or nearly-ANSI compilers to deal with nethack's old
code.  I left the USE_STDARG/USE_VARARGS/USE_OLDARGS stuff in place
even though anything supporting C99 shouldn't need that.  Some or
all of the [UN]WIDENED_PROTOTYPES stuff is still there too.

Closes #1030
2023-05-31 01:34:11 -07:00
nhmall
f3ad23fce2 first character of message window special outside putmixed
Issue #1042 states the following:
> Steps to reproduce:
> *name pet so that first (or only) character is non-ascii: example Ä or emoji.
> Most of the time the name is correctly shown.
> If new row starts with pet's name then character is not printed correctly.

The kludge for handling mixed glyphs and text shouldn't have been engaging
the special handling of the first character for anything outside of putmixed().
This should resolve that.
2023-05-31 00:10:22 -04:00
nhw_cron
dea25c73c2 This is cron-daily v1-May-8-2022. 000files updated: Files 2023-05-30 00:01:09 -04:00
nhmall
102c0e3270 fix directory in Makefile.mingw32 2023-05-29 23:07:51 -04:00
nhmall
579622c577 fixes entry for pull request 1028
Closes #1028
2023-05-29 22:44:46 -04:00
nhmall
7eea8291ef bring Makefile.nmake to parity for PR 1028 2023-05-29 22:40:30 -04:00
Ray Chason
9037592ea1 parent 97edec62b5
author Ray Chason <ray.chason@protonmail.com> 1684372172 -0400
committer nhmall <nhmall@nethack.org> 1685414340 -0400

Add configuration to support Curses on WinGUI

and enable support for Unicode on Curses.

Allow NetHackW to select the Curses interface

Reorder drawing of extended command prompt

Curses on WinGUI needs this change. This may be a bug in PDCursesMod,
but it seems to be harmless to the other ports.

Avoid calling Curses after the windows are closed

Provide erase_char and kill_char for WinGUI Curses

Set Lua version to 5.4.6
2023-05-29 22:39:43 -04:00
nhmall
97edec62b5 pdcurses submodules 2023-05-29 08:16:54 -04:00
PatR
0a16638fe4 data.base entry for "combat"
16 years ago the "combat" entry got inserted in between a comment and
the "cope" entry, making the comment end up being out of place.  Move
that and add a bit more detail.
2023-05-29 05:09:21 -07:00
nhmall
4bd7b79dd9 update sys/unix/hints/include/cross-pre.370 missed comment 2023-05-28 23:16:12 -04:00
nhmall
e6d94acbe1 update sys/unix/hints/include/cross-pre.370 2023-05-28 23:11:35 -04:00
nhmall
5e497ceeab sys/unix/Makefile.src 2023-05-28 23:08:39 -04:00
nhmall
b35d8a34ed update Lua version supported 2023-05-28 22:58:47 -04:00
PatR
b48cb5bcd9 sp_lev.c reformatting typo 2023-05-28 15:24:44 -07:00
PatR
d75862450e uhitm.c formatting 2023-05-28 15:22:43 -07:00
PatR
17d867d084 fix github issue #1038 - vampshifted Vlad in bones
Reported by vultur-cadens:  if Vlad made it to a level which allowed
bones and was in wolf or bat or cloud form when the hero died, he
would not be excluded from the bones file as intended.  When those
bones got loaded in another game, Vlad would become flagged as
extinct.  If that happened before his own level was reached, he
wouldn't be created when hero arrived thus there would be no way to
acquire the Candelabrum of Invocation.  (Even if his vampshifted
form had been carrying it, it wouldn't be present in the bones data
because it would have been converted into candles.)

Fixes #1038
2023-05-28 15:17:51 -07:00
PatR
6dac3c2183 mondata.c oversight
One recent 'reformatting' change which was more than just source
formatting introduced an unintentional change, turning locomotion
strings from local to mondata.c into global.  Make them be local
again.
2023-05-28 13:19:53 -07:00
PatR
3ccbfc4d6c sp_lev.c formatting 2023-05-28 00:49:53 -07:00
PatR
5cd7f1823c feedback when seeing hider-under hide under
If an monster hides under and object or under water while in view,
say so.

Also, the sanity check for a hidden eel wasn't consistent with the
hiding criteria for it.  An eel can't hide on the Plane of Water even
when it's in the water rather than in an air bubble.
2023-05-27 08:52:45 -07:00
PatR
b6a5be8d77 fix #K3922 - magic whistle vs hidden pet
When a hidden pet was relocated via magic whistle, a message was given
about "your <pet> appears" but it didn't show up on the map.

It was being marked as no longer undetected, but that was after rloc()
had moved it and redrawn its location.  use_magic_whistle() needed to
redraw its location again after clearing monst->mundetected.
2023-05-27 08:47:26 -07:00
PatR
e6521448f0 dungeon.c formatting 2023-05-27 02:47:23 -07:00
PatR
b19062d2c4 mondata.c formatting 2023-05-27 02:44:49 -07:00
PatR
2abe156516 potion of gain level tweak
Eliminate a use of non-literal format string and consequent need to
manipulate compiler warning settings.  Should be no change in behavior.
2023-05-26 14:03:48 -07:00
PatR
aa63aa8d98 issue #1027 - sticky 'nofollowers' flag
Reported by copperwater:  entering the tutorial sets 'u.nofollowers',
changing to the tutorial level saves a copy of 'u', post-level change
from entering the tutorial level resets u.followers, but subsequently
changing levels to return to the original level 1 restores 'u' from
the saved copy with has 'u.nofollowers==True', overriding the reset.

Move the nofollowers flag from 'u' to 'iflags'.  Invalides save and
bones files.

Fixes #1027
2023-05-25 17:08:53 -07:00
PatR
202afc3b55 choosing whether to run the tutorial
Revise the menu that asks whether to run the tutorial so that it will
accept ESC for "no".

Also, in its hint about how to suppress the menu, change vague "the
config file" to the actual configuration file name.  (This might need
a new 'sysconf' directive to control what's shown on servers where
the player doesn't have access to the file system, but the vague
description wasn't adequate for single player systems.)
2023-05-25 15:43:37 -07:00
PatR
cf8a49cae6 use to "feature" in DEBUGFILES
The code to lookup a value in DEBUGFILES usually operates on a file
name, but there are few non-file uses.  The latter wouldn't work on
VMS because of the way it was manipulating the name:  first stripping
away path, suffix, and version, then adding hardcoded ".c" suffix on.

I thought we already had a routine to get the base part of a name
from a full path, but if so, I haven't been able to find it.  This
adds new nh_basename() to do that, with the option of either keeping
or discarding the suffix or type portion.

The VMS usage that prompted this hasn't actually been tested.
2023-05-25 15:35:49 -07:00
nhmall
2876b6e8fd vmsbuild.com update 2023-05-24 19:46:33 -04:00
PatR
5dc8e98efa a couple of miscellaneous formatting bits 2023-05-24 11:23:15 -07:00
PatR
42356daec0 pull request #1024 - keep hero movement points
Pull request from saltwaterterrapin:  record current move's pending
movement points in save file.  They were being thrown away during
save and hero given 12 at time of restore.  Hero had to have had at
least 12 in order for player to issue the S command, but might have
had more than that if able to move faster than normal speed.

This implements it differently from the suggested commit.  Add new
field umovement to 'struct u' instead of using youmonst.movement and
needing to save and restore that separately.

Invalidates existing save and bones files.

Closes #1024
2023-05-24 11:16:23 -07:00
PatR
6586cc84b2 trap setting bit
Treat a trap object that has become the focus of trap setting
occupation as if it had already been used up.  (No discernable change
in behavior unless someone adds an artifact bear trap or landmine
that talks.)

Shouldn't 'trapinfo' be part of 'context' and be saved and restored?
(If so, it will need to include o_id and undergo pointer fixup during
restore.)  When trap arming is in progress hero will be too busy for
player to issue S(ave) command but a hangup save could take place.
2023-05-23 15:34:58 -07:00
PatR
8385d0a10e fixes entry for PR #1037 - use-after-free
when applying an object.

Pull request form copperwater:  applying a cream pie always uses it up
and applying a lump of royal jelly sometimes uses it up, then after
that use the apply got checked for a talking artifact.  If it had been
used up when the apply routine would access memory which had already
been freed.

Closes #1037
2023-05-23 15:03:03 -07:00
copperwater
d813f534ad Fix: use-after-free when applying an object that got destroyed
Found this running the fuzzer with address sanitizer. After applying an
object, the game checks whether it's a talking artifact so that it can
speak to you afterwards.

If, however, the object got destroyed in the process of applying it,
this will read and dereference obj after they have been freed. I found
this with a cream pie, which is always destroyed when someone applies
it.

To fix this, I tracked the obj pointer for what I think are the only two
cases in the big switch statement that don't track this - royal jelly
and cream pie. Royal jelly is only conditionally destroyed depending on
further input, so its function had to be refactored to take a struct
obj**, but cream pies are unconditionally destroyed so it can just be
set to null.
2023-05-23 15:03:02 -07:00
nhmall
65a0ff2d9a update OpenVMS com files (VSI C, NetHack-3.7) 2023-05-23 17:50:24 -04:00
Pasi Kallinen
39530f9228 Fix the mind flayer attacking without knowing your location
This was caused by the mind flayer mind blasting polymorphed hero,
causing them to revert back to human form, and dropping into a pool,
doing an automatic teleport to save them from drowning.
After that the mind flayer tried to hit them in melee, but the hero
was far away.

Recalculate the nearby and inrage variables after mind blast.
2023-05-23 19:24:19 +03:00
nhmall
4761bf190e OpenVMS update follow-up 2023-05-22 20:50:35 -04:00
nhmall
788ade31ca Revert "newest VSI C compiler uses different predefined macro"
This reverts commit 2dfe4c2a27.
2023-05-22 19:47:28 -04:00
PatR
ae0b306f9d sanity_check suppression
Handle ^P vs 'sanity_check' differently, and treat ^R similarly.
2023-05-22 14:43:01 -07:00
nhmall
08335c1e19 avoid a c++ issue in vmsconf.h 2023-05-22 15:31:18 -04:00
nhmall
ff727e916f work around a build issue with a compiler
One compiler was issuing an error diagnostic for cmap_to_glyph() macro (see below).
This just works around that by using cmap_a_to_glyph() which does not suffer the same fate.

mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "In_mines(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1448 in file mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "In_hell(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1448 in file mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "gd" is not constant, but occurs in a context that requires a constant expression.
at line number 1448 in file mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "on_level(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1448 in file mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "(&u.uz)->dnum" is not constant, but occurs in a context that requires a constant expression.
at line number 1448 in file mkmaze.c

    static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0,
.........................................^
%CC-E-NEEDCONSTEXPR, In the initializer for water_pos.glyph, "gd.dungeon_topology.d_sokoban_dnum" is not constant, but occurs in a context that requires a const
ant expression.
at line number 1448 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "In_mines(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "In_hell(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "gd" is not constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "on_level(...)" is not constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "(&u.uz)->dnum" is no
t constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c

    static const struct rm air_pos = { cmap_to_glyph(S_cloud), AIR, 0, 0, 0,
.......................................^
%CC-E-NEEDCONSTEXPR, In the initializer for air_pos.glyph, "gd.dungeon_topology.
d_sokoban_dnum" is not constant, but occurs in a context that requires a constant expression.
at line number 1450 in file mkmaze.c
2023-05-22 14:58:29 -04:00
nhmall
68b8e84aa3 changes to build with VSI C compiler
The changes from past OpenVMS compilers are #ifdef'd VMS9
2023-05-22 14:43:10 -04:00
nhmall
2dfe4c2a27 newest VSI C compiler uses different predefined macro
recognize __vms predefined compiler macro and ensure that VMS
is also defined because that is what NetHack source files
currently expect.
2023-05-22 14:25:08 -04:00
nhmall
13a5d978f9 remove a non-UNIX problematic define in termcap.c 2023-05-22 14:13:22 -04:00
nhmall
aab3bd695e don't do the #includes when cstd.h is used on c++ 2023-05-22 13:41:47 -04:00
PatR
1f8b3dfef5 ^P vs sanity_check
Normally when sanity_check is enabled it will take place for every
command executed.  Avoid that when the command is ^P because if a
sanity warning is a recurring one and the msg_window setting is
single or combination (tty-only) which shows one message, ^P will
just repeat each new warning without having any chance to cycle back
to earlier messages.
2023-05-22 00:32:25 -07:00
PatR
4e46a7de69 change enexto() to use collect_coords()
Greatly simplify enexto().  The new code might does more work up front
but less overall when/if a nearby spot is hard to find.
2023-05-21 17:30:06 -07:00