PatR [Mon, 14 Feb 2022 19:18:08 +0000 (11:18 -0800)]
Unix argcheck() usage
The checking for command line flags --version, --showpath, and one
or two others was inside #if CHDIR. I don't know whether anyone
ever disables that configuration option, but it shouldn't control
whether those flags are handled.
PatR [Mon, 14 Feb 2022 18:57:49 +0000 (10:57 -0800)]
man page update
For nethack.6, include the recently added 'optmenu' help file among
the list of files.
I didn't do anything about '-windowtype=xyzzy' though; there are some
other command line changes in the pipeline. The existing '-w' that
the new longer form enhances isn't in there either.
I took my name out for the claim of copyright. I've barely ever
touched this file. We see if that breaks the automated processing.
PatR [Sat, 12 Feb 2022 19:42:17 +0000 (11:42 -0800)]
unix command line
I wanted to be able to specify -windowtype:foo on the command line so
that I didn't have to use "NETHACKOPTIONS='windowtype:foo' nethack"
and it turned out that such an option already exists, as "-wfoo".
I either never knew about that or had completely forgotten it. Anyway,
this makes specifying windowtype be more versatile.
"-wX11" still works; now "-w X11", "-windowtype=X11", "-windowtype:X11"
work too, with "--" variations of the latter too also supported. The
long name can be truncated to any leading substring of "windowtype",
although it has to be at least "wi" for "--"; "--w" is rejected.
Also, any errors reported while processing the command line are
treated like config file processing errors rather than just delivered
with raw_printf(). On tty at least, they used to vanish when the
screen cleared to start the game, with no chance to read them. Here's
an example from after this change. It sets windowtype to tty and then
overrides that with X11.
|% ./nethack --w:Qt --win tty -wX11 -windowtype
|
|
| * Unknown option: --w:Qt.
| * Window type [nothing] not recognized. Choices are: tty, curses, X11, Qt.
|
|2 errors on command line.
|
|
|Hit return to continue:
This should probably be better integrated with argcheck() or vice
versa but the only change to that was a couple of formatting bits.
Anything that already worked should continue to work just the same,
aside from the improvement to the error feedback.
PatR [Sat, 12 Feb 2022 15:56:14 +0000 (07:56 -0800)]
fixes entry for pull request #677 - com_pager
From argrath, have com_pager_core() check for null return from
nhl_init() to pacify some code checker. If nhl_init() ever fails,
the program will never get far enough to try to use com_pager().
Pasi Kallinen [Sat, 12 Feb 2022 14:30:39 +0000 (16:30 +0200)]
Add paranoid:swim to prevent typoing into water or lava
In the name of accessibility: Prevent moving into dangerous liquids.
Now with themed rooms, water and lava are more common, and it's
unreasonable to expect blind players to check every step for those.
With paranoid:swim, just prevent normal walking into those liquids,
unless you prefix the movement with 'm', or if the liquid would not
harm you.
Doesn't completely prevent an accidental dunking - for example
if the hero is impaired or couldn't see the liquid.
This comes from xNetHack by copperwater <aosdict@gmail.com>
with some changes to the code.
PatR [Sat, 12 Feb 2022 15:28:40 +0000 (07:28 -0800)]
tty PICK_NONE menus
When testing the menu/incomplete map situation I noticed that <return>
didn't work to dismiss the "list autopickup exceptions" menu. <space>
or <escape> was required. That was clearly intentional but doesn't
seem reasonable. Make <return> behave the same for PICK_NONE as it
does for other menu modes in tty and as it does for other interfaces.
PatR [Sat, 12 Feb 2022 14:48:42 +0000 (06:48 -0800)]
fixes entry for pull request #673 - incomplete map
Sometimes tty left part of the screen blank after covering the entire
screen with a menu and then switching to a smaller menu that should
have redrawn the map as background. To reproduce:
| O - puts up a big menu
| : - enter a search string: "autopickup exception"
| <return> - dismiss the menu after the search makes one match
The autopickup exceptions sub-menu will be shown, with a small border
of map around it but most of the screen blank. (This behavior was
present before 3.6.0 but may not have been noticed because when the
discovered map doesn't extend to the corner menu's area, the blank
map probably seemed to be intentional. But if a fringe of map gets
drawn around the menu, that clearly isn't intended.) The incomplete
map is temporary; once menu is dismissed, it gets redrawn properly.
This adds a flush_screen() call after one particular docrt() call.
Perhaps docrt() should end with its own flush_screen() instead, but
that would require a lot more testing.
Michael Meyer [Tue, 8 Feb 2022 22:45:12 +0000 (17:45 -0500)]
Fix: tty map weirdness after 'full-screen' menu
When a 'full-screen' (cw->offx and cw->offy both 0) menu was immediately
followed by an offset menu -- as in the case of selecting certain
options from the options menu, or using loot to take out/put in items
after using ':' to describe the contents of a very full container --
there were some odd interactions with the map.
Only certain parts of the map near/under the menu window would be
redrawn if the first offset menu was followed by another one, while
a getlin prompt would cause the entire map to be redrawn, with parts
intersecting the window being drawn on top of it and obscuring it.
Flushing the display immediately after the docrt call when closing a
full-screen menu seems to fix both these issues.
PatR [Sat, 12 Feb 2022 00:17:17 +0000 (16:17 -0800)]
fix gamelog 1st kill vs 1st weapon hit sequencing
If the first monster the hero kills is killed by the hero's first hit
with a wielded weapon, report the hit first and kill second instead of
the other way around. Not as hard to manage as I feared, but bound to
be more fragile than the simpler handling that produced the odd order.
Also while testing it I knocked something into a polymorph trap and it
changed form without any feedback. Give foo-changes-into-bar message
if the hero is moving and can see it happening. It isn't needed with
a monster moves deliberately into a polymorph trap but probably would
be useful when that's is unintentional.
The "<hero> enters the dungeon" log message had a trailing period but
other log messages don't have sentence punctuation, so take that off.
PatR [Fri, 11 Feb 2022 22:43:01 +0000 (14:43 -0800)]
apple pasteboard
Turning on -Wformat-noliteral for Mac triggered a new warning.
Blindly suppressing the warning would have silenced it but would
also have left a real bug in place. The former format was passing
a string argument to %d format.
This converts the format to a literal with an additional argument
for the non-literal part. It compiles cleanly but I don't know how
to test it, let alone force an error for it to report.
PatR [Fri, 11 Feb 2022 20:10:20 +0000 (12:10 -0800)]
curses menu count entry
In a curses menu, if you type a digit to start a count, the cursor
jumps to the spot on the screen where the hero is. Strange and very
noticeable if that spot is covered by the menu, although I didn't
notice it when working on digits as group accelerators (changes for
that didn't trigger this).
Despite the cursor_on_u location, it isn't related to the recent
flush_screen/cursor_on_u changes either. In 3.6.x, curses used it's
own count entry code. Early on with to-be-3.7 it was changed to use
the core's get_count(), so uses a different routine to get next input
character. And the curses edition of that routine deliberately
positions the cursor at the hero's location on the assumption that
it only gets called when the map window is active.
Pasi Kallinen [Fri, 11 Feb 2022 18:13:20 +0000 (20:13 +0200)]
Don't show rusting of items landing in water
When a thrown item lands in a pool of water, it immediately
rusts - but don't give that message unless the hero is at the same
location and also under the water. My reasoning: hero can't see items
under water, and by the time the item rusts, it's in the water.
PatR [Fri, 11 Feb 2022 18:04:03 +0000 (10:04 -0800)]
curses: support digits as menu group accelerators
Have curses catch up with tty, X11, and Qt: if a menu of objects has
any heavy iron balls, their entries can be toggled on or off by using
'0' as a group accelerator. That's been supported by tty and X11 for
ages and by Qt since yesterday. This also supports having any digit
as a group accelerator so that the 'O' hack to pick number_pad mode by
typing the digit that matches the value description works (except for
menu entry for mode -1; '5' happens to work for that one but doesn't
match its description).
PatR [Fri, 11 Feb 2022 02:05:50 +0000 (18:05 -0800)]
Qt: support digit chars as menu group accelerators
Have Qt catch up with tty and X11: in a menu, when not already
entering a count and player types a digit, check whether it is the
group accelerator for any of the menu entries. If so, toggle their
selection state; if not, begin counting for the next item the player
eventually picks.
PatR [Thu, 10 Feb 2022 22:18:44 +0000 (14:18 -0800)]
number_pad menu hack
I don't try to toggle 'number_pad' very often, but when I do I almost
always type '0' instead of 'a' for Off or '1' instead of 'b' for On
on the first attempt. The menu shows
| a - 0 (off)
| b - 1 (on)
| c - 2 (on, MSDOS compatible)
| d - 3 (on, phone-style digit layout)
| e - 4 (on, phone-style layout, MSDOS compatible)
| f - -1 (off, 'z' to move upper-left, 'y' to zap wands)
This change makes '0' through '4' be undocumented group accelerators
for 'a' through 'e' (and '5' for 'f') in the sub-menu put up by 'O'.
tty and X11 worked as-is for '0' and required what amounts to a pair
of one-line changes to handle the other digits.
It doesn't work for curses and Qt (no idea about Windows GUI) because
they insist on treating any typed digit as the start of a count even
if one or more menu entries include that digit as a group accelerator.
(They also fail to support '0' as the group accelerator for iron-ball
class in the menu for multiple-drop.)
PatR [Thu, 10 Feb 2022 20:14:27 +0000 (12:14 -0800)]
memory management
MONITOR_HEAP+heaputil pointed out some unreleased memory. The livelog
stuff wasn't being freed. Not surpringly the data used for collecting
and formatting build-options that just got changed from strdup() to
dupstr() wasn't being freed. And a couple of date/version bits.
PatR [Thu, 10 Feb 2022 18:25:25 +0000 (10:25 -0800)]
strdup vs dupstr
mdlib.c was avoiding alloc() and dupstr() because mdlib.o gets linked
with makedefs and makedefs used to need to avoid those. But makedefs
doesn't avoid those anymore, so mdlib.c doesn't need to either.
Replace a couple of other strdup() calls in other files too.
PatR [Thu, 10 Feb 2022 13:45:07 +0000 (05:45 -0800)]
logging experience level changes again
The livelog message for losing a level had an off-by-1 error, showing
the level the hero ended up at rather than the level that was lost.
There was a message for regaining a previously lost level when rank
title stayed the same but no such message if the title changed (the
achievement of gaining a particular title only occurs once).
Say "regained" rather than "gained" when gaining a previously lost
level. (Blessed potions of full healing regain levels but can also
reduce u.ulevelmax so a different way to remember peak experience
level has been added.)
Report level change due to polymorphing into new man/woman/elf/&c.
I hadn't realized that that hasn't been recording achievement for new
rank when applicable and decided to leave things that way.
Report gender change when putting on an amulet of change or becoming
a new man/&c unless hero is polymorphed at the time or experience
level is also changing.
Pasi Kallinen [Thu, 10 Feb 2022 11:41:50 +0000 (13:41 +0200)]
Monsters should growl even if you can't hear it
Call growl even if you are deaf, because growling also
wakes up nearby monsters. Just make growl not show the message
if you can't hear or see the monster.
PatR [Thu, 10 Feb 2022 00:38:26 +0000 (16:38 -0800)]
cursed list vs worn light again
Fix a couple of mistakes in commit e8341dc9d79dbdc0013a287a9c8dfd627798883b
pointed out by vultur-cadens. While in read.c, reformat some of the
new livelog stuff.
PatR [Wed, 9 Feb 2022 22:25:32 +0000 (14:25 -0800)]
livelog tweaks
Log all level gains and loses. For the existing logging of changes
in rank, mention the level number with the new title. Classifying
level loss as "minor achievement" seems weird but I didn't see any
choice more appropriate.
Make '#chronicle' autocomplete. That makes "#ch" ambiguous, but
better to have to type #cha to chat than to have to completely spell
out #chronicle. (Changing it to #journal would make #j ambigious
but might still be an improvement.)
Pasi Kallinen [Wed, 9 Feb 2022 20:36:19 +0000 (22:36 +0200)]
Chronicle of major events, and livelog
Log game events, such as entering a new dungeon level, breaking
a conduct, or killing a unique monster, in a new "Major events"
chronicle. The entries record the turn when the event happened.
The log can be viewed with #chronicle -command, and the entries
also show up in the end-of-game dump, if that is available.
This feature is on by default, but can be disabled by
defining NO_CHRONICLE compile-time option.
This also contains "live logging", writing the events as they
happen into a single livelog-file. This is mostly useful for
public servers. The livelog is off by default, and must be
compiled in with LIVELOG, and then turned on in sysconf.
Mostly this a version of livelogging from the Hardfought server,
with some changes.
PatR [Wed, 9 Feb 2022 12:16:27 +0000 (04:16 -0800)]
enhanced water description
Redo how do_screen_description() handles water. Mainly by using
waterbody_name() for farlook/quicklook and autodescribe to get
hallucinatory descriptions, but it replaces some old hackery with
quite a bit of new hackery. Applies to lava and ice too. The latter
is now "frozen <foo>" when hallucinating, where <foo> has a small
chance to be "water" but will usually be something like "tea" or
"clotted blood".
PatR [Tue, 8 Feb 2022 19:06:26 +0000 (11:06 -0800)]
wishing for water terrain
Allow a wizard mode wish for "wall of water" to create WATER terrain.
Previously there was no way to do that. Wishing for "pool" and "moat"
work but "water" for terrain isn't supported because it yields a potion.
PatR [Tue, 8 Feb 2022 00:53:56 +0000 (16:53 -0800)]
using prefixes via their extended command names
Trying to use #reqmenu/#rush/#run/#fight prefixes by their extended
command names didn't work because rhack()'s post-processing was stuck
dealing with the entry for the '#' key after using doextcmd() to run
any command. Use a static variable (actually a global one since I put
it into struct g) to notify rhack() of the command that ultimately got
executed.
PatR [Mon, 7 Feb 2022 23:55:04 +0000 (15:55 -0800)]
<Mon> suddenly appears! vs ^G
For ^G, throttle the monster creation feedback. Don't say "suddenly"
and don't exclaim the message, just say "<Mon> appears." Also, use
Norep() so creating lots of similar monsters at once only gives a few
messages (just one unless varied by "next to you" vs "nearby" vs no
qualifier for farther away). And for mimics created as objects or
furniture, report the sudden appearance of new object or furniture.
PatR [Mon, 7 Feb 2022 22:22:41 +0000 (14:22 -0800)]
disallow g/G/F prefix with rush/run commands
Reject an attempt to specify a conflicting or redundant prefix with
a Ctrl+<move> or Shift+<move> (not numpad) or Alt+<move> (numpad).
'm' prefix is accepted.
nhmall [Mon, 7 Feb 2022 14:16:31 +0000 (09:16 -0500)]
fix two reported warnings with SERVER_ADMIN_MSG defined
Report stated a -Wformat-nonliteral at line 612,
and a -Wformat-security at line 614
I was only seeing the latter, so I added the former to the
flags in sys/unix/hints/include/compiler.370. Some compiler
versions have that warning on by default internally and others
don't. If the format string isn't a string literal, there's no
inteference with printf argument checking because that only
operates on string literals.
PatR [Mon, 7 Feb 2022 02:09:23 +0000 (18:09 -0800)]
more command prefix handling
When a command doesn't allow a prefix, go back to showing the prefix
keystroke in the can't-do-that feedback rather than the command name
that it has for potential binding. I went away from that earlier
after typing 'G' followed by 'o' and getting "the open command does
not accept 5 prefix" instead of "G prefix".
Fix the lookup routine which was responsible for that. At least
partially fix it; actually it only ignores digits for !numpad. If a
numpad user types G where it isn't allowed, the feedback will still
be about 5 instead of G. The code is going from keystroke-used to
command-it-invokes back to keystroke-for-command which won't
necessarily yield the original keystroke because a command can be
bound to more than one key.
PatR [Mon, 7 Feb 2022 01:46:31 +0000 (17:46 -0800)]
fix movement prefixes
My earlier change resulted in rejecting all commands entered after
a movement prefix key, rather than just ones that aren't supposed to
take any prefix.
This fixes that and also restores the ability to use 'm>' or 'm<' on
stairs to change levels without auto-pickup at the destination.
PatR [Sun, 6 Feb 2022 21:20:15 +0000 (13:20 -0800)]
water description
The wall of water goaded me into updating waterbody_name(). It's
mostly the same, aside from being moved from mkmaze.c to pager.c and
adding "{wall of|limitless} water" instead of plain "water" for WATER
terrain. I'm not very happy with "limitless" for the Plane of Water
because limits imposed by air bubbles are all over the place. "Wall
of water" might work ok for that level.
Water on Medusa's level is now described as "shallow sea" rather than
lame "water". The two unusual pools on the Samurai home level are
described as "pond" rather than previous "water" which replaced 3.6's
ridiculous "moat". When lava is hallucinated, it is described as
"molten <substance>" (yielding silly things like "molten yoghurt"),
rather than just "<substance>" to distinguish it from hallucinated
water. 'autodescribe' doesn't use waterbody_name() though.
PatR [Sun, 6 Feb 2022 19:51:00 +0000 (11:51 -0800)]
command prefix handling
Investigating github issue #664 by argrath turned up a more
significant problem. Prefixes other than 'm' preceding commands
that don't use a prefix didn't get rejected but didn't do anything.
Pasi Kallinen [Sun, 6 Feb 2022 18:38:18 +0000 (20:38 +0200)]
Make solid water behave more consistently
The "water" terrain (as used on the Plane of Water) behaved
strangely outside the plane. Make it behave a bit more consistently,
although it's still not really usable elsewhere.
The rationale here being it's a solid wall of water.
Firstly, disable levitation and flying (which was already done
when moving into the water on the Plane of Water), and moving into
it refers to it as a "wall of water" to make it clear it's a solid
block of water.