]> granicus.if.org Git - nethack/log
nethack
3 years agotty perm_invent options again
PatR [Tue, 21 Jun 2022 16:56:59 +0000 (09:56 -0700)]
tty perm_invent options again

I'm not sure what happened but something that worked when I tested
yesterday wouldn't work today.  Have 'O' was pass TRUE rather than
FALSE to tty_perm_invent_toggled() when perm_invent is set to 'on'.
And skip that code for .nethackrc or NETHACKOPTIONS because it was
segfaulting.

3 years agofix [again] exploiting artifact name rejection
PatR [Tue, 21 Jun 2022 15:57:58 +0000 (08:57 -0700)]
fix [again] exploiting artifact name rejection

Reported by entrez:  attempting to name certain undiscovered items
after an artifact could be used to tell whether the item being named
was the same type as the artifact, so trying to name a gray stone
the Heart of Ahriman would let you tell whether it was a luckstone.
That was fixed years ago to reject for any undiscovered gray stone
rather than only for luckstone; you'll get "your hand slips" and the
name would be smudged.  But that fix allowed a loophole and could
still be exploited if the player used lowercase for the name:  it
would get changed to mixed capitalization if the object was the
artifact's type or stay lowercase if it only matched by description.

This changes to the capitalized name even when the type isn't an
exact match, so attempting to name either a luckstone or a touchstone
"the heart of ahriman" will name it "The Aeart of Xhriman" with at
least one smudged letter to avoid the actual artifact name.

Unrelated change:  when attempting to apply a new name to an existing
artifact, it now says "<Artifact> resists" rather than "The artifact
seems to resist" because there's no "seeming" about it.

3 years agofix msdos build in CI
nhmall [Tue, 21 Jun 2022 12:31:52 +0000 (08:31 -0400)]
fix msdos build in CI

3 years agoboolean options parsing bit
PatR [Tue, 21 Jun 2022 08:08:07 +0000 (01:08 -0700)]
boolean options parsing bit

Boolean switches: add an omitted 'break', plus a few 'default' cases
that would matter if someone turned on the warning about a switch
statement with 'enum' index that doesn't have cases for all possible
values of that enum.  I haven't made any attempt to be exhaustive
about those; these few were just right in the same place.

3 years agoupdates for msdos cross-compile
nhmall [Tue, 21 Jun 2022 07:15:25 +0000 (03:15 -0400)]
updates for msdos cross-compile

gcc 12.1.0

also incorporate a libc patch for djgpp

3 years agosome tty perm_invent follow-ups
nhmall [Tue, 21 Jun 2022 01:17:45 +0000 (21:17 -0400)]
some tty perm_invent follow-ups

end-of-game disclosure toggles perm_invent so
react to that to tear down the tty perm_invent

fix if-block layout in tty_create_nhwindow()

3 years agotrouble linking
nhmall [Mon, 20 Jun 2022 23:58:16 +0000 (19:58 -0400)]
trouble linking

Add a switch to the C files if the ++ linker will be used due
to WANT_WIN_QT=1.

3 years agoclear an unused variable warning
nhmall [Mon, 20 Jun 2022 23:57:13 +0000 (19:57 -0400)]
clear an unused variable warning

3 years agotty perm_invent option handling
PatR [Mon, 20 Jun 2022 23:18:50 +0000 (16:18 -0700)]
tty perm_invent option handling

The code for toggling perm_invent when windowtype=="tty" was inserted
into the middle of several switch cases that share 'need_redraw' so
was getting executed for various other options such as 'use_inverse'
that precede it in the list of cases.  It was also continuing on to
general feedback for boolean options, reporting "'perm_invent option
toggled on" even if it failed and the option stayed off.

3 years agosilence -Wunused-parameter warning
nhmall [Mon, 20 Jun 2022 18:17:57 +0000 (14:17 -0400)]
silence -Wunused-parameter warning

3 years agokeep perm_invent option
nhmall [Mon, 20 Jun 2022 17:43:50 +0000 (13:43 -0400)]
keep perm_invent option

Make it apparent why tty perm_invent can't be set in-game
if the terminal cannot support it.

3 years agoEnable TTY_PERM_INVENT
Patric Mueller [Mon, 20 Jun 2022 16:07:24 +0000 (18:07 +0200)]
Enable TTY_PERM_INVENT

The permanent inventory will be automatically shown if the terminal size
allows.
But only output an error message if the player requested it via
perm_invent option.

3 years agoexperimental config option TTY_PERM_INVENT
nhmall [Mon, 20 Jun 2022 14:40:55 +0000 (10:40 -0400)]
experimental config option TTY_PERM_INVENT

Add a rudimentary experimental always-up inventory display
capability to tty when the perm_invent option is in effect.
It requires an additional 28 rows available on the terminal
underneath the bottom status line.

It hasn't been optimized for performance as of yet.

3 years agomore Verbose
nhmall [Mon, 20 Jun 2022 01:02:50 +0000 (21:02 -0400)]
more Verbose

Make verbose a prefix compound option. verbose and !verbose
should still work just as the boolean option did.

verbose0, verbose1, verbose2, verbose3, verbose4 must be
given a decimal value in the config file to set the bits in
verbosity_suppressions[0] through verbosity_suppressions[4].
That can be used to suppress any messages represented by the
verbosity_values defined in include/hack.h.

This also adds a more verbose variation of prinv() where the
total count is included in the message (that particular more
verbose message can be suppressed with OPTIONS=verbose3:134217728).

  Verbose(n,x) name     Hex Value       Decimal             Option
  -------------------------------------------------------------------
  interrupt_multi       0x00000001               1          verbose0
  use_stethoscope       0x00000002               2          verbose0
  Mb_hit                0x00000004               4          verbose0
  adjattrib             0x00000008               8          verbose0
  ballfall              0x00000010              16          verbose0
  use_crystal_ball1     0x00000020              32          verbose0
  use_crystal_ball2     0x00000040              64          verbose0
  digactualhole1        0x00000080             128          verbose0
  digactualhole2        0x00000100             256          verbose0
  mdig_tunnel1          0x00000200             512          verbose0
  mdig_tunnel2          0x00000400            1024          verbose0
  boulder_hits_pool1    0x00000800            2048          verbose0
  boulder_hits_pool2    0x00001000            4096          verbose0
  drop1                 0x00002000            8192          verbose0
  drop2                 0x00004000           16384          verbose0
  drop3                 0x00008000           32768          verbose0
  go_to_level1          0x00010000           65536          verbose0
  go_to_level2          0x00020000          131072          verbose0
  go_to_level3          0x00040000          262144          verbose0
  rot_corpse            0x00080000          524288          verbose0
  getpos1               0x00100000         1048576          verbose0
  getpos2               0x00200000         2097152          verbose0
  off_msg               0x00400000         4194304          verbose0
  on_msg                0x00800000         8388608          verbose0
  Blindf_on             0x01000000        16777216          verbose0
  dog_eat               0x02000000        33554432          verbose0
  dog_invent            0x04000000        67108864          verbose0
  dokick                0x08000000       134217728          verbose0
  toss_up               0x10000000       268435456          verbose0
  consume_tin1          0x20000000       536870912          verbose0
  consume_tin2          0x40000000      1073741824          verbose0
  doengrave1            0x00000001               1          verbose1
  doengrave2            0x00000002               2          verbose1
  doengrave3            0x00000004               4          verbose1
  explode               0x00000008               8          verbose1
  moverock              0x00000010              16          verbose1
  still_chewing         0x00000020              32          verbose1
  trapmove1             0x00000040              64          verbose1
  trapmove2             0x00000080             128          verbose1
  trapmove3             0x00000100             256          verbose1
  trapmove4             0x00000200             512          verbose1
  trapmove5             0x00000400            1024          verbose1
  getobj1               0x00000800            2048          verbose1
  getobj2               0x00001000            4096          verbose1
  doprgold              0x00002000            8192          verbose1
  doorlock1             0x00004000           16384          verbose1
  doorlock2             0x00008000           32768          verbose1
  monpoly1              0x00010000           65536          verbose1
  monpoly2              0x00020000          131072          verbose1
  mswingsm              0x00040000          262144          verbose1
  missmu                0x00080000          524288          verbose1
  mswings               0x00100000         1048576          verbose1
  wildmiss              0x00200000         2097152          verbose1
  gulpmu                0x00400000         4194304          verbose1
  explmu                0x00800000         8388608          verbose1
  meatmetal1            0x01000000        16777216          verbose1
  meatmetal2            0x02000000        33554432          verbose1
  meatmetal3            0x04000000        67108864          verbose1
  meatmetal4            0x08000000       134217728          verbose1
  relobj                0x10000000       268435456          verbose1
  ready_weapon          0x20000000       536870912          verbose1
  wield_tool            0x40000000      1073741824          verbose1
  meatobj1              0x00000001               1          verbose2
  meatobj2              0x00000002               2          verbose2
  meatobj3              0x00000004               4          verbose2
  meatobj4              0x00000008               8          verbose2
  meatcorpse1           0x00000010              16          verbose2
  meatcorpse2           0x00000020              32          verbose2
  mpickgold             0x00000040              64          verbose2
  mpickstuff            0x00000080             128          verbose2
  setmangry             0x00000100             256          verbose2
  mb_trapped            0x00000200             512          verbose2
  m_move1               0x00000400            1024          verbose2
  m_move2               0x00000800            2048          verbose2
  m_move3               0x00001000            4096          verbose2
  m_move4               0x00002000            8192          verbose2
  m_move5               0x00004000           16384          verbose2
  thitu1                0x00008000           32768          verbose2
  thitu2                0x00010000           65536          verbose2
  m_throw               0x00020000          131072          verbose2
  handler_menustyle     0x00040000          262144          verbose2
  handler_autounlock    0x00080000          524288          verbose2
  handler_msg_window    0x00100000         1048576          verbose2
  handler_whatis_coord1 0x00200000         2097152          verbose2
  handler_whatis_coord2 0x00400000         4194304          verbose2
  dolook                0x00800000         8388608          verbose2
  describe_decor1       0x01000000        16777216          verbose2
  describe_decor2       0x02000000        33554432          verbose2
  loot_mon              0x04000000        67108864          verbose2
  dotip                 0x08000000       134217728          verbose2
  polymon               0x10000000       268435456          verbose2
  teleds                0x20000000       536870912          verbose2
  level_tele            0x40000000      1073741824          verbose2
  ghost_from_bottle     0x00000001               1          verbose3
  dodip1                0x00000002               2          verbose3
  dodip2                0x00000004               4          verbose3
  dodip3                0x00000008               8          verbose3
  intemple              0x00000010              16          verbose3
  doread1               0x00000020              32          verbose3
  doread2               0x00000040              64          verbose3
  doread3               0x00000080             128          verbose3
  doread4               0x00000100             256          verbose3
  doread5               0x00000200             512          verbose3
  doread6               0x00000400            1024          verbose3
  doread7               0x00000800            2048          verbose3
  drop_boulder_on_player0x00001000            4096          verbose3
  do_genocide           0x00002000            8192          verbose3
  call_kops1            0x00004000           16384          verbose3
  call_kops2            0x00008000           32768          verbose3
  call_kops3            0x00010000           65536          verbose3
  erode_obj1            0x00020000          131072          verbose3
  erode_obj2            0x00040000          262144          verbose3
  erode_obj3            0x00080000          524288          verbose3
  trapeffect_rocktrap   0x00100000         1048576          verbose3
  climb_pit             0x00200000         2097152          verbose3
  drown                 0x00400000         4194304          verbose3
  mon_adjust_speed      0x00800000         8388608          verbose3
  hit                   0x01000000        16777216          verbose3
  miss                  0x02000000        33554432          verbose3
  makewish              0x04000000        67108864          verbose3
  prinv                 0x08000000       134217728          verbose3
  do_attack             0x00000001               1          verbose4
  known_hitum           0x00000002               2          verbose4
  hmon_hitmon1          0x00000004               4          verbose4
  hmon_hitmon2          0x00000008               8          verbose4
  mhitm_ad_tlpt         0x00000010              16          verbose4
  mhitm_ad_wrap1        0x00000020              32          verbose4
  mhitm_ad_wrap2        0x00000040              64          verbose4
  mhitm_ad_dgst         0x00000080             128          verbose4
  damageum              0x00000100             256          verbose4
  missum                0x00000200             512          verbose4
  hmonas1               0x00000400            1024          verbose4
  hmonas2               0x00000800            2048          verbose4
  hmonas3               0x00001000            4096          verbose4
  hmonas4               0x00002000            8192          verbose4
  passive               0x00004000           16384          verbose4
  flash_hits_mon        0x00008000           32768          verbose4

3 years agofix #2779 - Windows GUI pulldown help menu \
PatR [Sun, 19 Jun 2022 23:55:39 +0000 (16:55 -0700)]
fix #2779 - Windows GUI pulldown help menu \

specifies duplicate accelerator keystrokes

Reported and diagnosed nine and half years ago but never fixed.

In the WinGUI-specific help menu (under the titlebar, not nethack's
'?' command), both "&Long description of the game" and "&Longer list
of game options" use &L as accelerator.  Typing 'L' or 'l' highlights
one of the entries, then <enter> is needed to execute it or typing
another 'L' or 'l' unhighlights it and highlights the other.  Other
accelerators in that menu execute their entries immediately, without
the need for <enter>.

Change the first one to "Long description of the &game" so that 'G'
or 'g' becomes its accelerator.

That menu is missing several things that have been added to the menu
for '?'.  I put in placeholder comments for them but won't pursue
them further.

Untested.

3 years ago\#wizkill feedback
PatR [Sun, 19 Jun 2022 20:50:15 +0000 (13:50 -0700)]
\#wizkill feedback

If is mon not sensed or seen and you use #wizkill to kill it, report
"You kill an unseen mon." rather than just "You kill the mon."  Also,
override hallucination when identifying the victim.

3 years agoanother x_monnam() tweak
PatR [Sun, 19 Jun 2022 18:36:40 +0000 (11:36 -0700)]
another x_monnam() tweak

The former special case for a/an prefix wasn't partlicularly special.

3 years agocode paths through x_monnam()
PatR [Sun, 19 Jun 2022 09:44:18 +0000 (02:44 -0700)]
code paths through x_monnam()

Reduce the number of early returns in x_monnam().  There shouldn't be
any change in observable behavior.

3 years agoyet more magic whistle
PatR [Sun, 19 Jun 2022 09:39:43 +0000 (02:39 -0700)]
yet more magic whistle

'optr' was accidentally left around from an intermediate revision.
There's no reason to keep it as a comment.

3 years agodebugpline() fix
PatR [Sun, 19 Jun 2022 09:30:45 +0000 (02:30 -0700)]
debugpline() fix

Something which occurred to me when looking at the magic whistle code.
It's behavior can vary depending upon whether pline()/You()/&c has
been called and that is detected by checking whether pline() has reset
iflags.last_msg.  Change the debugpline() mechanism to prevent it from
interfering with that.

3 years agosilence three compile warnings
nhmall [Sun, 19 Jun 2022 08:56:48 +0000 (04:56 -0400)]
silence three compile warnings

apply.c:495:22: warning: variable 'optr' set but not used [-Wunused-but-set-variable]
    struct permonst *optr;
                     ^
1 warning generated.
cmd.c:4577:26: warning: variable 'how' set but not used [-Wunused-but-set-variable]
    const char *dothat, *how;
                         ^
cmd.c:4578:29: warning: variable 'viawindow' set but not used [-Wunused-but-set-variable]
    boolean prefixhandling, viawindow;
                            ^
2 warnings generated.

3 years agomagic whistle followup
PatR [Sun, 19 Jun 2022 08:40:07 +0000 (01:40 -0700)]
magic whistle followup

3 years agouse the new Makefile target
nhmall [Sat, 18 Jun 2022 17:52:49 +0000 (13:52 -0400)]
use the new Makefile target

Also, try setting continueOnError: true

3 years agosome documentation-related changes
nhmall [Sat, 18 Jun 2022 17:32:17 +0000 (13:32 -0400)]
some documentation-related changes

add a command-line pdf option to Makefile for use in CI.
fix .tex file errors.

3 years agoThis is cron-daily v1-May-8-2022. 000files updated: Files
nhw_cron [Sat, 18 Jun 2022 15:24:08 +0000 (11:24 -0400)]
This is cron-daily v1-May-8-2022.  000files updated: Files

3 years agofollow-up bit
nhmall [Sat, 18 Jun 2022 15:03:59 +0000 (11:03 -0400)]
follow-up bit

3 years agotypo in last commit
nhmall [Sat, 18 Jun 2022 14:44:22 +0000 (10:44 -0400)]
typo in last commit

3 years agoGuidebook datestamping
nhmall [Sat, 18 Jun 2022 14:29:15 +0000 (10:29 -0400)]
Guidebook datestamping

Allow the hints file to apply a correct timestamp to
the Guidebooks prior to use.

Detect the NH_DATESUB in the Guidebook.mn or Guidebook.tex
files and replace the datestamping line that follows.

If git is available, it determines the hash of the last commit
applied to doc/Guidebook.mn, and then determines the date of
that commit.  The interim Guidebook.dated.mn (or
Guidebook.dated.tex) gets the datestamp applied.

If git isn't available or doesn't correctly provide the hash
for doc/Guidebook.mn, it should just continue to use whatever
hard-coded date in the Guidebook.mn source file (it uses it
instead of the interim file).

3 years agofeedback for bad command prefix usage
PatR [Sat, 18 Jun 2022 00:59:05 +0000 (17:59 -0700)]
feedback for bad command prefix usage

The old code to supply a list of directions if a prefix was followed
by a non-direction didn't work as intended anymore.  Add some more
precise feedback for gGF mis-use and comment out some code that never
gets executed.

A number_pad user can get a complaint about 'G' when using '5' followed
by a non-directional command.  Too bad for them.

Supersedes pull request #803

3 years agomagic whistle bandage
PatR [Fri, 17 Jun 2022 21:58:02 +0000 (14:58 -0700)]
magic whistle bandage

Reported by entrez:  if magic whistle summoned a pet onto a trap, the
messages produced could be in the wrong sequence or contradictory.
The code was collecting counts and name-of-first for shift (was seen
before whistling, seen at different spot after), for appear (wasn't
seen before, now is), and for disappear (was seen before, now isn't)
before dealing with a trap at arrival location.  The trap could issue
a message (including pet killed, pet sent away--teleport trap, hole,
&c--or pet changed shape--which occurred after its name/old shape was
saved for use when it was the only one in its category), and finally
the summary message was issued.

Change the code to handle arriving in a trap before the collection
into the three categories that provide feedback, and skip the latter
if any message was given during mintrap().  That handles the most
glaring anomalies like killed followed by shifted location or takes
on new shape followed by old shape shifted or appeared.  But it no
longer gives specific shift/appear/disappear feedback for those cases.
Pets that don't land on traps or who land on ones that don't issue
any feedback aren't affected.

The accessibility aspect of this--message feedback in order to avoid
tedious screen reading of the map--will need to be satisfied by the
trap feedback unless/until someone comes up with a better solution.
One possibility is an option to allow player to have rloc() always
issue its vanish and appear messages.  Right now it does so when magic
whistle hasn't been discovered yet, then avoids that hyper-verbosity
(if hero has multiple pets) once it has.  Or the whistle code could
count the number of pets first, then behave as if such an option is in
effect when the count is small and only resort to the current summary
method if the count is larger than some threshold.

3 years agoTypo in opthelp
Patric Mueller [Fri, 17 Jun 2022 14:57:03 +0000 (16:57 +0200)]
Typo in opthelp

3 years agoadd macOS-latest entry to CI
nhmall [Fri, 17 Jun 2022 14:23:27 +0000 (10:23 -0400)]
add macOS-latest entry to CI

3 years agouse corrected imagename in CI
nhmall [Fri, 17 Jun 2022 14:15:13 +0000 (10:15 -0400)]
use corrected imagename in CI

3 years agoadd macOS monterey to CI
nhmall [Fri, 17 Jun 2022 14:05:13 +0000 (10:05 -0400)]
add macOS monterey to CI

3 years agopipelines fix 03
nhmall [Fri, 17 Jun 2022 13:41:30 +0000 (09:41 -0400)]
pipelines fix 03

3 years agopipelines fix 02
nhmall [Fri, 17 Jun 2022 13:30:24 +0000 (09:30 -0400)]
pipelines fix 02

3 years agopipelines fix 01
nhmall [Fri, 17 Jun 2022 13:25:43 +0000 (09:25 -0400)]
pipelines fix 01

3 years agoadd newer ubuntu and gcc to CI
nhmall [Fri, 17 Jun 2022 12:47:00 +0000 (08:47 -0400)]
add newer ubuntu and gcc to CI

3 years agodocumentation update
PatR [Fri, 17 Jun 2022 10:18:52 +0000 (03:18 -0700)]
documentation update

Incorporate the diff from entrez describing the travel_debug wizard
mode option and removing obsolete M prefix from the Guidebook.  That
missed a reference to it in the description of '_'.

I put M back in case someone who has used it with earlier versions
tries to use it and gets a no-such-command complaint so goes looking
for it.

Also, make the mention of ^X at the end of the discussion of status
stand out a bit.  The indentation of its paragraph made it line up
with the preceding text instead of making it be distinct from that.

The TeX changes are untested and given the amount of punctuation
characters used, it will be surprising if they all have been quoted
properly.

3 years agoignoring features when checking version compat
PatR [Thu, 16 Jun 2022 18:00:53 +0000 (11:00 -0700)]
ignoring features when checking version compat

The nomakedefs stuff for cross-compiling support broke the code to
treat enabling or disabling some optional features as not breaking
save and bones file compatibility.  It was relying on a macro whose
definition was local to mdlib.c rather than propagated among files.
makedefs still constructs date.h with a value indicating the ignored
features but the actual compatability check doesn't use that anymore.
Toggling SCORE_ON_BOTL shouldn't have caused existing files to be
rejected but they were.

3 years agominor perm_invent fix
PatR [Thu, 16 Jun 2022 16:42:52 +0000 (09:42 -0700)]
minor perm_invent fix

3 years agorecent changes caused a compile issue with QT
nhmall [Thu, 16 Jun 2022 02:22:15 +0000 (22:22 -0400)]
recent changes caused a compile issue with QT

On a machine with both homebrew and macports, the presence of
macports was causing the homebrew Qt settings to be overwritten
right after they were set. Check to see if QTDIR is already
defined before proceeding with QT macports.

3 years agoremove a couple of debugging-output lines in macOS.370
nhmall [Wed, 15 Jun 2022 23:17:30 +0000 (19:17 -0400)]
remove a couple of debugging-output lines in macOS.370

3 years agoanother macOS.370 hint tweak
nhmall [Wed, 15 Jun 2022 23:07:28 +0000 (19:07 -0400)]
another macOS.370 hint tweak

3 years agocorrect some conditional code in hints macOS.370
nhmall [Wed, 15 Jun 2022 22:58:44 +0000 (18:58 -0400)]
correct some conditional code in hints macOS.370

3 years agomore macOS.370 ncurses tinkering
nhmall [Wed, 15 Jun 2022 22:34:47 +0000 (18:34 -0400)]
more macOS.370 ncurses tinkering

3 years agosome macports updates
nhmall [Wed, 15 Jun 2022 20:00:13 +0000 (16:00 -0400)]
some macports updates

if macports is detected:
- check for ncurses from macports
- adjust the library search path to include /opt/local/lib
- adjust the C compiler include search path to include /opt/local/include
  via -I/opt/local/include.
- if libncursesw* is in /opt/local/lib, link with it.

Also, USEMACPORTS=1 will use macports if you have both homebrew and macports.
It isn't required, but the ordering in the Makefile will use homebrew first
otherwise.

3 years agoitemized billing vs persistent inventory, round II
PatR [Tue, 14 Jun 2022 22:48:45 +0000 (15:48 -0700)]
itemized billing vs persistent inventory, round II

Reported by entrez:  buying an unpaid item using itemized billing used
to result in the price information for unpaid items disappearing when
they get shown by perm_invent.  (Their status as unpaid didn't change;
persistent inventory just got redrawn without cost information.)  The
fix for that didn't handle buying a used-up item.  There's no invent
update for the gone-item item but there is one for moving gold out of
hero's inventory to add to shopkeeper's inventory.  The vanishing
price phenomenon applied to that situation too.

I can't think of any situation where persistent inventory would want
to hide unpaid status and/or cost, so always prevent those from being
excluded during perm_invent update.

3 years agosimulated mouse click for #therecmdmenu
PatR [Mon, 13 Jun 2022 23:06:06 +0000 (16:06 -0700)]
simulated mouse click for #therecmdmenu

The #therecmdmenu command calls getdir() which issues an "in what
direction?" prompt.  This allows you to answer with "_" instead of a
regular direction, then it will call getpos() to allow you to move
the cursor and type "," (or ";") to behave as if a left-click had
been done or type "." (or ":") to behave as right-click.

Ordinarily I would think of the 'normal' getpos() response of "."
as suitable for left-click, then one of the other getpos finishers
for right-click, but comma is left of period on a standard keyboard
and that seems useful for remembering which is used for which click.

Left clicking on a spot farther than one step away offers travel,
throw iff lined up, and also click-look as choices.  If you right
click farther than one step away, it will only offer click-look.
The look choice for either left or right click isn't inhibited by
having the clicklook option set to False.  After all, player is
explicitly choosing the menu entry to look at something.

New getdir.mouse can be bound to some other key than "_" and the
getpos.pick* responses could already be re-bound, but there's no
separate getdir.left/right that could be used to bind different keys
from those used for the four getpos responses.

3 years agofix 'simplify streamlined act_on_act()'
PatR [Mon, 13 Jun 2022 21:44:20 +0000 (14:44 -0700)]
fix 'simplify streamlined act_on_act()'

Still more PR #777.  Commit c4c6c3d73a broke #therecmdmenu travel,
throw, and far-look.  It was restricting dx and dy unnecessarily
and that resulted in not specifying the correct location when the
destination was farther than one step away.

Testing those properly requires a mouse.  I've implemented a way
to simulate a left or right click at getdir()'s prompt (only useful
for #therecmdmenu).  That will be committed separately.

3 years agoColor check for 256 and 24 bit color output with enhanced symbols
Patric Mueller [Mon, 13 Jun 2022 18:35:40 +0000 (20:35 +0200)]
Color check for 256 and 24 bit color output with enhanced symbols

Adding a check for using the 256 or 24 bit color escape sequnces only if
the terminal supports it.

3 years agoFix wrong glyph for tuwall in Enhanced1 symset
Patric Mueller [Mon, 13 Jun 2022 16:49:26 +0000 (18:49 +0200)]
Fix wrong glyph for tuwall in Enhanced1 symset

3 years agosimplify streamlined act_on_act()
PatR [Mon, 13 Jun 2022 18:30:59 +0000 (11:30 -0700)]
simplify streamlined act_on_act()

More PR #777:  there's no need for there_cmd_menu() to pass absolute
<x,y> instead of <dx,dy> for a couple of actions.  Those actions can
reconstruct <x,y> by adding <dx,dy> to <u.ux,u.uy>.

3 years agobetter feedback for '& m' and '? f m'
PatR [Mon, 13 Jun 2022 11:41:31 +0000 (04:41 -0700)]
better feedback for '& m' and '? f m'

For the description of what a keystroke does, augment 'm' (or whatever
key has been bound to #reqmenu) to replace the default description
|m      prefix: request menu or modify command (#reqmenu).
with
|m      movement prefix: move without autopickup and without attacking
|m      non-movement prefix: request menu or modify command (#reqmenu).

The text is delivered by pline so tty will issue --More-- between the
two lines.

3 years agohack.c reformatting
PatR [Mon, 13 Jun 2022 10:35:46 +0000 (03:35 -0700)]
hack.c reformatting

Mostly adjusting some wide lines.  Should be no change in generated
code.

3 years agostreamline act_on_act()
PatR [Mon, 13 Jun 2022 10:13:11 +0000 (03:13 -0700)]
streamline act_on_act()

Refine the code from pull request #777 by changing act_on_act() to
take 3 arguments instead of 6.  x,y and dx,dy are mutually exclusive
so it doesn't need both pairs provided that the caller is adjusted
to pass the ones appropriate for the action, and dir is easily
derived from dx,dy for the couple of cases that use it.

3 years agonoxious quest nemeses
PatR [Sun, 12 Jun 2022 20:19:13 +0000 (13:19 -0700)]
noxious quest nemeses

Refine the code added by pull request #763 to check the quest nemesis
death message for reference to noxious fumes rather than having the
three relevant roles be hardcoded.

3 years agosome Qt6 Makefile tinkering
nhmall [Sun, 12 Jun 2022 15:59:34 +0000 (11:59 -0400)]
some Qt6 Makefile tinkering

Adjust for a package available on ubuntu jammy jellyfish 22.04 LTS,
but one that doesn't seem to follow the norm.

3 years agofixes entry for pull request #770 - wizard splbook
PatR [Sat, 11 Jun 2022 22:32:37 +0000 (15:32 -0700)]
fixes entry for pull request #770 - wizard splbook

Pull request from matteverett:  for generating starting equipment,
mark a wizard as having received a level 1 spellbook when getting
guaranteed force bolt so that the random second spellbook can be
level 1, 2, or 3 as intended rather than unintentionally be forced
to be level 1.

Closes #770

3 years agoMove check for starting L1 spellbook to include non-random spellbooks
Matthew Everett [Sun, 22 May 2022 04:09:28 +0000 (21:09 -0700)]
Move check for starting L1 spellbook to include non-random spellbooks

3 years agopull request #798 - fix typo in disclosure \
PatR [Sat, 11 Jun 2022 22:13:30 +0000 (15:13 -0700)]
pull request #798 - fix typo in disclosure \

of vanquired monsters.

Pull request from janne-hmp:  the test for how many spaces to insert
in front of "the <unique monster>" couldn't match prefix "the "
because it was specifying a length of 3 instead of the 4 required to
include the trailing space.

Despite that clear error, the code worked as intended because the
default value of 0 is the same as an explicit value of 0 it would
have gotten if it had matched "the ".  So there is no change in the
resulting vanquished monsters display.

Closes #798

3 years agoChanged the comparison length of "the " from 3 to 4 to account for the space in the...
janne-hmp [Sat, 11 Jun 2022 13:50:04 +0000 (16:50 +0300)]
Changed the comparison length of "the " from 3 to 4 to account for the space in the end.

3 years agomonsters less likely to dig in Sokoban
PatR [Sat, 11 Jun 2022 18:38:52 +0000 (11:38 -0700)]
monsters less likely to dig in Sokoban

Make monsters being created in Sokoban that are given a random
defensive item be less likely to receive a wand of digging.  Should
result in fewer extra holes needing to be plugged.

Resurrected from an old stash entry.  I have no recollection of why
I didn't consider it to be ready for prime time way back then.

3 years agocut-and-paste error follow-up
nhmall [Sat, 11 Jun 2022 18:00:15 +0000 (14:00 -0400)]
cut-and-paste error follow-up

3 years agog++-12 bits, mostly Qt5 related
nhmall [Sat, 11 Jun 2022 17:52:58 +0000 (13:52 -0400)]
g++-12 bits, mostly Qt5 related

I forced a test compile to -std=c++20 mostly to see what we would
be up against. There was only a small number of things and they
are corrected in this commit.

c++20 has some issues with comparisons and bit twiddling between
different enums.

The vendor-supplied Qt5 header files triggered some of those issues as
well, so the qt_pre.h and qt_post.h NetHack header files were adjusted
to make those new warnings go away.  I have not tested Qt6 under the
new compiler and c++ version yet.

Because there are multiple pragmas in qt_pre.h now, the conditional
ifdef structure in there was modified a little to make maintenance
simpler and have a single pragma push at the top. The pragma pop
comes after the Qt vendor-supplied header files, and is done
in qt_post.h.

The display.h macro cmap_to_glyph() was used in
a Qt c++ file and triggered a series of warnings because of that.
Rather than write c++20-friendly versions of those macros, the
simple fix is to provide a function on the C side of things
to front the cmap_to_glyph() macro, so fn_cmap_to_glyph()
was added.

Also thrown into this commit, PatR picked up on the fact that for
yesterday's new warning in qt_menu.cpp, the compiler had correctly
picked up on the fact that the format range of the variable 'cash'
had been correctly upper-capped at 999999999L in the warning message
because of an assignment prior. He suggested that perhaps by also adding
    if (cash < 0)
       cash = 0;
the warning might be eliminated altogether.
After a test, that was proven to be correct, so yesterday's
more-kludgy change is reverted and replaced with that variable
variable restriction ahead of the snprintf().

3 years agoMerge branch 'pr791' into NetHack-3.7
nhmall [Sat, 11 Jun 2022 15:07:42 +0000 (11:07 -0400)]
Merge branch 'pr791' into NetHack-3.7

3 years agocleaning-up on gd_move() pr #791
nhmall [Sat, 11 Jun 2022 15:06:08 +0000 (11:06 -0400)]
cleaning-up on gd_move() pr #791

Closes #791

3 years agoMerge branch 'fix-vault' of https://github.com/argrath/NetHack into pr791
nhmall [Sat, 11 Jun 2022 15:02:23 +0000 (11:02 -0400)]
Merge branch 'fix-vault' of https://github.com/argrath/NetHack into pr791

3 years agofix warnings
SHIRAKATA Kentaro [Sat, 11 Jun 2022 08:18:34 +0000 (17:18 +0900)]
fix warnings

3 years agosimplify unpunish()
PatR [Sat, 11 Jun 2022 07:11:48 +0000 (00:11 -0700)]
simplify unpunish()

unpunish() duplicated much of delobj() in order to use dealloc_obj().
Switch to delobj().  That required a fix to feel_location() when it
was called by savebones() after vision is turned disabled.

3 years agoSome cleanup for saving bones
PatR [Sat, 11 Jun 2022 07:09:14 +0000 (00:09 -0700)]
Some cleanup for saving bones

3 years agosaving/freeing ball and chain
PatR [Sat, 11 Jun 2022 07:08:17 +0000 (00:08 -0700)]
saving/freeing ball and chain

Reported by entrez:  fix memory being accessed after having been
freed by trying to keep ball&chain data up to date when they're
processed by the save code.  This fix is a little more elaborate
than this suggested one.  I'm crossing my fingers on this one....

3 years agonew warnings showed up in old code
nhmall [Sat, 11 Jun 2022 04:18:27 +0000 (00:18 -0400)]
new warnings showed up in old code

A test build with gcc-12 cause two new warnings to appear.

mkmaze.c: In function ‘makemaz’:
mkmaze.c:983:44: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
983 |                 Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto,
    |                                            ^
In file included from ../include/config.h:665,
                 from ../include/hack.h:10,
                 from mkmaze.c:6:
../include/global.h:262:24: note: ‘sprintf’ output between 4 and 31 bytes into a destination of size 20
262 | #define Sprintf (void) sprintf
mkmaze.c:983:17: note: in expansion of macro ‘Sprintf’
983 |                 Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto,
    |                 ^~~~~~~-+

As usual, that one can easily be rectified by replacing it with an Snprintf() call.
There were several Sprintf calls in the vicinity, targeting the same destination
buffer, so I figured that I might as well replace the several.

../win/Qt/qt_menu.cpp: In member function
‘virtual void nethack_qt_::NetHackQtTextWindow::UseRIP(int, time_t)’:
../win/Qt/qt_menu.cpp:1082:63: warning:
‘%ld’ directive output may be truncated writing between 1 and 20 bytes into a region
of size 17 [-Wformat-truncation=]
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |                                                               ^~~
../win/Qt/qt_menu.cpp:1082:62: note: directive argument in the range [-9223372036854775808999999999]
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |                                                              ^~~~~~~~
../win/Qt/qt_menu.cpp:1082:20: note: ‘snprintf’ output between 5 and 24 bytes into a destination of size 17
1082 |     (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash);
     |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That one was a little different. It wasn't complaining about the destination buffer
size in the way -Wformat-overflow was on the previous warning from gcc, and it
was already using snprintf().

It looks like what the C++ compiler was warning about there, was that snprintf()
informs you after-the-call that the destination buffer was too small for the
result string to be fully written. It informs the developer of that by returning
the number of characters that would have been written if the buffer had been big
enough. Presumably, the C++ compiler picked up on the fact that the return value
was being cast to void, thus throwing away that truncation information from the
return value.

Worked around it by putting the return value into a variable, and flagging the
variable with nhUse(variable) so as not to exchange the -Wformat-truncation
warning with a variable-set-but-not-used warning.

3 years ago\#wizkill while engulfed
PatR [Fri, 10 Jun 2022 22:19:01 +0000 (15:19 -0700)]
\#wizkill while engulfed

Targetting any of the eight surrounding spots while swallowed will
kill the engulfer.  Picking a spot farther away reports "no monster
there" even if there does happen to be one at the chosen spot.

3 years agoleft out of commit e2d694ed32
PatR [Fri, 10 Jun 2022 21:36:55 +0000 (14:36 -0700)]
left out of commit e2d694ed32

3 years agofix github issue #769 - revive panic
PatR [Fri, 10 Jun 2022 18:35:07 +0000 (11:35 -0700)]
fix github issue #769 - revive panic

Issue #769, reported by k2 and diagnosed by entrez:  eating a troll
corpse that revives on the last turn of the meal was using up the
corpse while the revival was in progress (unless the hero couldn't
observe the resulting monster), leading to a panic when trying to
use it up at the end of revival.  Brought on by a recent change to
interrupt an occupied hero who can observe a hostile monster being
created nearby.

The fix isn't perfect.  If revival fails because there's no place
to put the revived troll, the meal will be interrupted with one bite
left instead of finishing.  If that happens, the interruption will
include a "you stop eating" message, just with no explanation why.
The partly eaten--almost completely eaten--corpse will remain.

Closes #769

3 years agoobject splitting bit
PatR [Fri, 10 Jun 2022 17:14:06 +0000 (10:14 -0700)]
object splitting bit

Something else noticed while hunting for the revive() panic.  Like
the zap.c change (56b791f7cc), doesn't fix that or impact its
eventual fix.

3 years agocouple of revive() bits
PatR [Fri, 10 Jun 2022 17:11:10 +0000 (10:11 -0700)]
couple of revive() bits

Noticed while hunting for the panic.  They don't fix it but also
won't interfere with the eventual fix.

3 years agosuppress warnings during vs 3rd party x64 builds
nhmall [Fri, 10 Jun 2022 00:02:19 +0000 (20:02 -0400)]
suppress warnings during vs 3rd party x64 builds

These warning are in 3rd party library builds (one
in Lua relating to padding due to alignment), and
a few in pdcurses. We won't be addressing the code
in  those.

3 years agogranular verbose message suppression mechanics updated
nhmall [Thu, 9 Jun 2022 19:16:28 +0000 (15:16 -0400)]
granular verbose message suppression mechanics updated

update the macro definition

[re-do full commit message due to errors in last one]

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

flags.verbose = 0
is still a master suppression of all the verbose messages.

flags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).

3 years agogranular verbose message suppression mechanics
nhmall [Thu, 9 Jun 2022 17:53:20 +0000 (13:53 -0400)]
granular verbose message suppression mechanics

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

iflags.verbose = 0
is still a master suppression of all the verbose messages.

iflags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).

3 years agocorrect an assignment value in restore.c
nhmall [Thu, 9 Jun 2022 12:16:58 +0000 (08:16 -0400)]
correct an assignment value in restore.c

3 years agoadd reset_justpicked() comment
PatR [Thu, 9 Jun 2022 07:37:14 +0000 (00:37 -0700)]
add reset_justpicked() comment

3 years agoutf8 warning fix
PatR [Thu, 9 Jun 2022 07:28:44 +0000 (00:28 -0700)]
utf8 warning fix

Avoid gcc/clang warning about mixing || with && without parentheses.
The code already worked as intended despite the warning.

3 years agoremove extraneous file
nhmall [Thu, 9 Jun 2022 04:46:49 +0000 (00:46 -0400)]
remove extraneous file

3 years agoMerge branch 'argrath-20220609' into NetHack-3.7
nhmall [Thu, 9 Jun 2022 04:45:59 +0000 (00:45 -0400)]
Merge branch 'argrath-20220609' into NetHack-3.7

3 years agoa couple of argrath pull requests
nhmall [Thu, 9 Jun 2022 04:43:35 +0000 (00:43 -0400)]
a couple of argrath pull requests

Closes #777 https://github.com/NetHack/NetHack/pull/777
Closes #793 https://github.com/NetHack/NetHack/pull/793

3 years agoMerge branch 'fix-symbols' of https://github.com/argrath/NetHack into argrath-20220609
nhmall [Thu, 9 Jun 2022 04:41:34 +0000 (00:41 -0400)]
Merge branch 'fix-symbols' of https://github.com/argrath/NetHack into argrath-20220609

3 years agoMerge branch 'fix-cmd-3' of https://github.com/argrath/NetHack into argrath-20220609
nhmall [Thu, 9 Jun 2022 04:39:13 +0000 (00:39 -0400)]
Merge branch 'fix-cmd-3' of https://github.com/argrath/NetHack into argrath-20220609

3 years agoMerge branch 'pr794' into NetHack-3.7
nhmall [Thu, 9 Jun 2022 04:36:57 +0000 (00:36 -0400)]
Merge branch 'pr794' into NetHack-3.7

3 years agofixes entry: vampire shapeshifting in a door #794
nhmall [Thu, 9 Jun 2022 04:35:00 +0000 (00:35 -0400)]
fixes entry: vampire shapeshifting in a door #794

Closes #794

3 years agoMerge branch 'vampire-door' of https://github.com/entrez/NetHack into pr794
nhmall [Thu, 9 Jun 2022 04:33:13 +0000 (00:33 -0400)]
Merge branch 'vampire-door' of https://github.com/entrez/NetHack into pr794

3 years agofixes entry for pr #783
nhmall [Thu, 9 Jun 2022 03:45:02 +0000 (23:45 -0400)]
fixes entry for pr #783

Resolves #783

3 years agoRe: [NetHack/NetHack] Prompts can overwrite copyright notice on the
nhmall [Thu, 9 Jun 2022 03:41:45 +0000 (23:41 -0400)]
Re: [NetHack/NetHack] Prompts can overwrite copyright notice on the
starting screen (Issue #783)

On 2022-06-01 12:22 p.m., NetSysFire wrote:
> Steps to reproduce:
>
>1. Get any prompt and answer it. In my case it was a horribly old
>   save I forgot about or when I wiztested something and forgot
>   about that save, too.
>2. See that the copyright information got overwritten by the prompt:
>
>There is already a game in progress under your name. Destroy old game? [yn] (n)
>         By Stichting Mathematisch Centrum and M. Stephenson.
>         Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>         See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Expected behavior:
>
> Redraw after a prompt was answered, so the prompt vanishes and the
> entirety of the starting screen will be shown.
>
> NetHack, Copyright 1985-2022
>          By Stichting Mathematisch Centrum and M. Stephenson.
>          Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>          See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Proposed severity: low. Not gamebreaking, it is cosmetic only and does
> not have any other consequences.
>

The Copyright notice is placed by tty internal routines writing onto
the BASE_WINDOW fairly early in the startup sequence.

The prompt to "Destroy old game? [yn] (n)" is using the in-game
routine to write to the message window at the top of the screen and
prompt there, just like in-game prompts and messages.

If the player answered 'y' to that, the prompt for
"Shall I pick character's race, role, gender and alignment..."
appeared immediately after. That one, however, is written using
the BASE_WINDOW routines in tty, like the copyright notice.

This change does the following:

It moves the copyright lines down a little bit leaving room for the
"Destroy.." prompts.

It places the "Shall I pick characters's..." prompt further down the
screen by default, leaving some room for about 3 raw_print startup
messages after the copyright notice, just in case there are any.
The "Shall I pick character's..." prompt will still appear immediately
if there is a prompt such as "Destroy old game?..."

There were a couple of other issues around raw_print startup messages
too. Those are delivered using a raw_print mechanism to ensure they
are written even if the window-port is not fully operational. However,
they were only on the screen for the blink of an eye. This call
sequence in restore.c made them disappear almost immediately:
     docrt() -> cls()

Put in a mechanism to detect the presence of raw_print messages
from the early startup, and if there were some, wait for a
keypress before obliterating the unread notifications.

3 years agoFix: vampire shapeshifting in a door
Michael Meyer [Wed, 8 Jun 2022 23:50:48 +0000 (19:50 -0400)]
Fix: vampire shapeshifting in a door

Someone mentioned in #nethack today that a vampire had turned into a fog
cloud, moved under a door, then turned back into a vampire while still
sharing a space with a closed door.  There already existed some code
intended to prevent this in cases where the vampire is killed in one
form and revives in another, but voluntary transformations (from
decide_to_shapeshift) weren't included.  The existing code in mondead
and vamp_stone also apparently missed a minor edge case: because the
code between the definition of in_door and its use included an expels
call, it would be outdated/incorrect in cases where expels() placed the
fog cloud onto a closed door.

3 years agodeath from touching silver ring or wand
PatR [Wed, 8 Jun 2022 19:50:49 +0000 (12:50 -0700)]
death from touching silver ring or wand

From a reddit thread:  NAO's list of causes of death shows
|killed by handling a(n) ring of shock resistance
|killed by handling a(n) wand of fire
along with various other rings and wands and the poster wondered how
that could have killed characters.  Someone quickly figured out that
the heroes involved had lycanthropy and the items listed happened
to be silver in those games.

Avoid that sort of confusion in future by specifying "handling a
silver ring" or "handling a silver wand" instead of the specific
type of item when inflicting silver damage.  It still uses specific
item for other classes of objects where silver isn't shuffled among
potential items at start of game.

3 years agomagic portal traversal feedback
PatR [Wed, 8 Jun 2022 17:46:51 +0000 (10:46 -0700)]
magic portal traversal feedback

Replace the old message "you feel dizzy for a moment, but the sensation
passes" when going through a magic portal.  The sensation doesn't just
pass anymore; you arrived stunned these days.  Suggested by entrez.

3 years agoremove unnecessary null-check on parsesymbols()
SHIRAKATA Kentaro [Sun, 5 Jun 2022 07:22:21 +0000 (16:22 +0900)]
remove unnecessary null-check on parsesymbols()

`strval` here is always non-null,
because the null-check is done in earlier code.

3 years agoartifact name formatting bit
PatR [Mon, 6 Jun 2022 23:15:07 +0000 (16:15 -0700)]
artifact name formatting bit

All the quest artifacts are named "The <something> of <someone>".
Change xname() to force "the" instead of "The" when that occurs in
the middle of "a skeleton key named The Master Key of Thievery" or
"a pair of lenses named The Eyes of the Overworld".

This change isn't applied to user-assigned names; they're used as-is.

3 years agosplit cleaning-up on gd_move() into separate function
SHIRAKATA Kentaro [Sun, 22 May 2022 13:37:01 +0000 (22:37 +0900)]
split cleaning-up on gd_move() into separate function