PatR [Tue, 22 Dec 2020 21:48:29 +0000 (13:48 -0800)]
fix #K3231 - objects vs pits and holes
This got out of hand pretty quickly. can_reach_floor() had
different criteria than trap activation. Objects dropped at a
hole locations that don't fall through were treated as if they
were at the bottom of an abyss, so couldn't be examined or
picked up.
This a bunch of changes; it is bound to introduce some new bugs.
PatR [Tue, 22 Dec 2020 19:10:32 +0000 (11:10 -0800)]
Qt support for changing 'statuslines' dynamically
Turns out it was nearly as simple as I originally thought.
I just missed one significant detail the first time around.
This leaves DYNAMIC_STATUSLINES as conditionl but now enables
it by default. Using 'O' to change 'statuslines' from 2 to 3
or vice versa now works for Qt as well as for curses and tty.
PatR [Tue, 22 Dec 2020 03:02:11 +0000 (19:02 -0800)]
option help
I stated out by changing dat/opthelp to stop shouting the boolean
defaults: [TRUE] -> [True], [FALSE] -> [False]. I ended up doing
a partical reconcilliation between ?g (dynamic list of options)
and ?h (dat/opthelp). There were several inapplicable options in
the dynamic list, so this changes option_help() to avoid those.
I barely glanced at the compound options so they may not sync up.
PatR [Mon, 21 Dec 2020 22:09:17 +0000 (14:09 -0800)]
AC and obj->spe limits: +127/-128 -> +99/-99
Cap overall AC at -99 instead of -128. Put the same limit of 99
on enchantment and charge count of individual objects.
^X now reports if/when AC has reached its limit since players
could see that reaching that limit and then enchanting worn items
will change the worn items but not the total. (Same thing would
have happened with -128, just without any explanation and less
likely to accomplish.)
Won't affect normal play for any reasonable definition of normal.
Pasi Kallinen [Sun, 20 Dec 2020 10:23:09 +0000 (12:23 +0200)]
More futureproofing hypotheticals
If you set COLNO larger than BUFSZ, few places cause a buffer overrun.
Add a new buffer size definition, COLBUFSZ, which is the larger of
COLNO and BUFSZ, used in places that care about a screen-wide string.
PatR [Sun, 20 Dec 2020 01:45:49 +0000 (17:45 -0800)]
re-implement pull req #334 - sorting discoveries
The pull request changed \ and ` output to unconditionally show
discoveries in alphabetical order. That's nearly useless except
when looking at prediscovered weapons and armor that fighter
types start out knowing.
This allows the player to choose sorting order via the new
'sortdiscoveries' option. In addition to setting it via
config file or 'O', it can be set via 'm' prefix for \ and `.
Choices are:
o - sort by class, by order of discovery in class (default);
s - sort by 'sortloot' classification which groups sub-class
items (so all helmets before any other armor, then all
gloves, then boots, and so on); within each sub-class, or
whole class for classes which don't subdivide so usefully,
partly-discovered types (where a name has been assigned)
come before fully ID'd types;
c - sort by class, alphabetically within class;
a - sort alphabetically across all classes.
Turned out to be a large amount of work for fairly little gain,
although I suspect that 'sortdiscoveries:s' will eventually be
more popular than the default.
Invalidates existing save files so that current sort setting can
persist across save/restore cycles.
PatR [Fri, 18 Dec 2020 23:46:13 +0000 (15:46 -0800)]
displacing pets into water
Don't let hero at water or lava location swap places with a
pet that can't survive there. This was a regression to 3.4.3
behavior introduced when displacer beast monster was added.
I can't remember whether the regression was intentional at the
time, but guess not because I'm fairly sure that I would have
included a comment about it.
PatR [Fri, 18 Dec 2020 23:05:54 +0000 (15:05 -0800)]
concealed monster sanity checks
Add some more checks to sanity_check_single_mon(). If mon->data
is discovered to be bad, panic instead of just issuing a warning
since a subsequent crash would be inevitable. Make sure hidden
ceiling hiders have a ceiling to hide at (so not on the planes of
air or water; some quest levels should probably be classified as
"no ceiling" but currently aren't). Perform a few mimic checks.
Protection from shape changers had a couple of minor bugs. A mimic
hidden at a spot the hero couldn't see would be allowed to remain
hidden (and stay that way once within view because protection from
shape changers isn't re-checked during ordinary activity). Also,
if a pet was shape-changed while eating a mimic corpse at the time
protection from shape changers started, it would fall into untimed
sleep as part of being forced back to normal shape [rescham()] if
its location could be seen.
PatR [Thu, 17 Dec 2020 21:55:10 +0000 (13:55 -0800)]
Qt text window search
Fix the strangeness where typing ':' in a menu window initiated
the menu search operation but typing ':' in a text window saw
the shift key be pressed but not the ';' that went with it, even
though they both called the same key decoding routine. That made
typing ':' to initiate text search be impossible. Menu windows
did more input focus manipulation in their constructor. Mimicking
that in text windows fixes the problem with keys not being seen by
the text window's keystroke handler.
PatR [Thu, 17 Dec 2020 20:21:35 +0000 (12:21 -0800)]
fix the tail-less long worm placement warning
Hidden tail segment was taken off the map as intended but the
check and warning in place_wormtail_randonly() didn't expect
to see that. A post-3.6 issue.
Also fix the spelling error in the warning message.
PatR [Thu, 17 Dec 2020 19:38:18 +0000 (11:38 -0800)]
click_to_cmd() vs #therecmdmenu
Clicking on an adjacent location while 'herecmd_menu' is On
didn't run therecmd as intended. If it had, maybe somebody
would have noticed how broken it is. This reorganizes the mouse
click handling but leaves therecmd commented out since it hasn't
been fixed.
The #therecmdmenu command and tentative click handling for
adjacent spots should probably be removed. They've been in place
for slightly over three years and nobody has ever reported that
they don't work properly.
PatR [Thu, 17 Dec 2020 03:22:04 +0000 (19:22 -0800)]
adopt some orphan commands
'? i' shows three keyless commands in the General section. This
makes M-X the key for #exploremode. #herecmdmenu and #therecmdmenu
are still keyless but now autocomplete.
A ridiculous amount of documentation for a three line code change.
PatR [Wed, 16 Dec 2020 11:07:55 +0000 (03:07 -0800)]
allow #exploremode from wizard mode
Allow changing form debug mode to explore mode without resorting
to a debugger. The same caveat, "you won't be able to change back,"
applies as when in normal play.
Character's name will remain "wizard" rather than reverting to
whatever it would have been if not starting in wizard mode.
PatR [Wed, 16 Dec 2020 00:33:51 +0000 (16:33 -0800)]
'? i' refinement
Make the key bindings help better able to decide whether a key
binding actually works. If you bind some command to a key that is
used by default for a prefix, the commands array will indicate that
it (the bound key) runs the bound command. But if you don't bind
some other key to the prefix action, typing that earlier key will
perform the prefix action instead. The code for displaying the
list of key bindings needs to know that for the case where no other
key runs the command.
BINDINGS=M:takeoffall
will still report 'A'==takeoffall, which continues to work, but it
would not show 'M'==takeoffall because 'M' is still used to run
without autopickup which takes precedence over ordinary commands.
BINDINGS=A:nothing
BINDINGS=M:takeoffall
would omit any mention of takeoffall in the '? i' output. Now it
will show #takeoffall as a keyless command at the end of the 'Game
commands' section.
PatR [Mon, 14 Dec 2020 21:12:33 +0000 (13:12 -0800)]
spell learning feedback
Tell the player the spell casting letter when learning a new spell:
|You add "knock" to your repertoire, as 'e'.
Comparable to "k - ring mail" when picking up a suit of ring mail
puts it into inventory slot k.
PatR [Mon, 14 Dec 2020 20:32:43 +0000 (12:32 -0800)]
Qt paper doll bit
Override the 'implicit_uncursed' option when formatting an item
of equipment for its paper doll tool tip. Each tile is outlined
in yellow if known to be uncursed; force "uncursed" in the tool
tip text for the same situation.
Bart House [Mon, 14 Dec 2020 18:17:02 +0000 (10:17 -0800)]
Final changes needed to enable Windows minGW build.
Removed some of the temporary changes necessary due to 4 hour delay.
Added the specification of the working directory to avoid the change
in working directory behavior that occurs when checking out one
repository vs. two.
Bart House [Mon, 14 Dec 2020 17:56:59 +0000 (09:56 -0800)]
Modify expectations of where LUA sources are located.
We want the build to assume the same basic layout as the lua repository.
The sources are immediately at the top of the repository and not in
a subdirectory called 'src'.
PatR [Mon, 14 Dec 2020 11:30:58 +0000 (03:30 -0800)]
github pull request #417 - disclosing apron text
Adopt the patch to show the writing on any alchemy smocks in
hero's inventory during end of game disclosure.
I also added one more saying among the choices for alchemy
smock/apron. It's based on a T-shirt descibed in a movie.
(I remember the description of the text but I don't remember
noticing anybody wearing the T-shirt that lead to that.)
Since so many of the smock quotes are about cooking, it seems
better to add it as an alchemy quote instead of just another
T-shirt where there'd be no context to explain it.
PatR [Mon, 14 Dec 2020 10:11:53 +0000 (02:11 -0800)]
Qt 'game' menu tweak for OSX
Change "_Quit-without-saving" in the Game dropdown menu to be
"\177Quit-without-saving". That makes the prefix used on OSX to
prevent matching "^[&]?[Qq][Uu][Ii][Tt].*" be invisible.
Also change the order of the choices for the command+Q and
application dropdown menu entry "quit nethack" so that "cancel
and return to game" is the default for arbitrary response to the
confirmation prompt. <return> and <space> select "quit without
saving". Note that the nethack dropdown menu is OSX-specific
(a Qt feature to emulate other OSX applications) and its
nethack->Quit action is separate-from/in-addition-to Game->Quit
menu action mentioned above (which runs nethack's #quit command).
PatR [Mon, 14 Dec 2020 09:00:19 +0000 (01:00 -0800)]
have <del> run #terrain
Having recently noticed that using <del> aka <delete> aka <rubout>
could work as a command, assign it to #terrain. #terrain was the
only command in the "game" subset of commands as shown by '? i'
that didn't have any key assignment.
Since <delete> might be swapped with <backspace> on some terminals
and is a keypad key on the typical PC keyboard, it might not work
reliably depending on nethack's number_pad mode or the hardware
Num-Lock setting. Players in either of those situations haven't
lost anything; they can still use extended command #terrain.
PatR [Sun, 13 Dec 2020 23:51:23 +0000 (15:51 -0800)]
bargethrough/monster-vs-monster displacing
Fix the regression that monster movement flag unification
introduced for monsters able to swap places with adjacent
monsters. It used to be restricted in order to prevent
Riders swapping places with other Riders so that they didn't
repeatedly exchange places when one was right behind the other
and the farther one moved first. Then when displacer beasts
were added, that restriction was extended to prevent them
swapping places with Riders (but not the other way around.)
The flags change inadvertently let any displacer swap with any
other displacer.
PatR [Sun, 13 Dec 2020 21:45:04 +0000 (13:45 -0800)]
Qt: remove "Search [______]" from Help menu
Prevent Qt from inserting an extra entry in the Help dropdown
menu displayed in the menu bar across the top of the screen
when nethack has focus. "Search [______]" lets the user enter
a string to search for but doesn't give nethack any control
over that so we can't have it.
I haven't found a sane way to get rid of it. The insane way
of not naming any menu "Help" works. This uses "\177Help" so
that it still looks like "Help" but won't match that string.
Pasi Kallinen [Sun, 13 Dec 2020 10:28:42 +0000 (12:28 +0200)]
Make Death revive faster
Death will revive faster than the other riders.
Make all the riders revive after 67 turns, instead of 500.
There was practically a zero chance a rider would revive at 500,
so keep it somewhat sensible.
Michael Meyer [Fri, 11 Dec 2020 23:13:56 +0000 (18:13 -0500)]
Improve consistency of polearm targeting rules
Multiple functions are involved in the process of targeting and
attacking an enemy with a polearm or lance, and these functions
previously used inconsistent tests to determine which targets were
legal. For instance, find_poleable_mon would give up immediately if the
hero was blind, while neither get_valid_polearm_position nor use_pole
cared as long as the hero could detect a target on the square (e.g. by
ESP). find_poleable_mon considered warning symbols as potential
targets, but use_pole discarded them. get_valid_polearm_position
considered moats and pools to be illegal targets, but use_pole would
let the hero successfully hit a monster on those squares; on the
other hand, get_valid_polearm_position would mark squares that were not
visible and did not contain a known monster as legal targets, while
find_poleable_mon and use_pole would exclude them.
Obviously this was inconsistent and could introduce confusion for
polearm users, who would potentially need to explicitly target squares
marked "(illegal)" at some point over the course of their game, among
other problems. This commit makes polearm targeting tests more
consistent; the following rules are applied to positions within the
appropriate range:
* Monsters which are detected by any means that reveals an actual
monster glyph are legal to target, even if the hero is blind
* Monsters the hero cannot detect, but is aware of -- i.e. those
represented by an 'I' -- are similarly legal to target
* Monsters detected via warning are not legal targets, since the hero
does not have as strong a sense of where exactly they are, their shape
and size, etc
* Statues are legal targets, but will not be suggested by
find_poleable_mon unless the hero is impaired (confused, stunned, or
hallucinating); the same is true of tame/peaceful monsters
* Apparently empty squares, including those containing an undetected
monster, are legal to target unless they cannot be seen (whether due
to blindness or a very dark room/level)
* Positions which are otherwise legal but are blocked by an obstruction like a
tree or pillar are not legal targets
PatR [Sat, 12 Dec 2020 22:10:18 +0000 (14:10 -0800)]
Makefile vs lua fix
I've been ignoring submodules so far. For the old method of
dealing with lua, the instructions
You might need to do
make spotless
make fetch-lua
aren't adequate. They should be
When lua version has changed in Makefile.top, before running
setup.sh to put that new Makefile in place, do
make spotless
then
sys/unix/setup.sh [hints/...]
make fetch-lua
otherwise it will try to clean up the not yet fetched new lua
version instead of the old one.
PatR [Sat, 12 Dec 2020 20:04:20 +0000 (12:04 -0800)]
fix github pull request #418 - towel wetness
Fire damage would dry out a wet towel but never all the way to 0.
Water damage would wet a towel but if it was already wet, its
wetness might decrease.
This uses the pull request's change for increasing the wetness
but changes dry_a_towel so that the original code for decreasing
that will work as is. Using wet_a_towel() to set wetness to 0
doesn't make much sense, so still won't do so; dry_a_towel() does
and now will.
This also adds missing perm_invent update for towels in inventory
changing wetness.
Bart House [Sat, 12 Dec 2020 19:47:44 +0000 (11:47 -0800)]
Fix Azure pipeline introduced by only checking out a single repository.
If checking out a single repository, the repository is checked out
to the path $(Agent.BuildDirectory)\s instead of
$(Agent.BuildDirectory)\s\<name of repository>. Modified checkout
to hard code path to avoid this change in behavior.
PatR [Sat, 12 Dec 2020 06:32:38 +0000 (22:32 -0800)]
fix #H3134 - selling container for credit
If a container holds anything that a shop wouldn't ordinarily
buy and sell and you sell it for gold, the 'foreign' contents
are marked no_charge and hero still owns them. But selling the
same container+contents for credit instead of gold would take
shop possession of all the contents without increasing the
credit amount.
The fixes entry is longer than the fix. It solves cited case but
I won't be surprised much if it messes up some other case(s).
PatR [Sat, 12 Dec 2020 02:11:27 +0000 (18:11 -0800)]
Qt text search crash fix
About 5 weeks ago, commit e4106bb1613da808ae87780dfeedb4c80e6afc2a
changed Qt's searching in text windows to be able to find a match
on the very first line. It assumed that the first line would be
the current line except when repeating the same search after a
match. But after a failed search the current line index is -1 and
starting a new search would crash trying to look that line up.
PatR [Sat, 12 Dec 2020 01:15:21 +0000 (17:15 -0800)]
dowhatis formatting for Qt
The '/' command's variants /o, /O, /m, and /M use spaces to
align output in columns and that looks quite bad if rendered in
a proportional font. Qt normally uses proportional font for
text windows but it watches the supplied lines for any with four
consecutive spaces and forces fixed-width font if it sees any.
So changing the existing separator line from "" to " " makes
Qt format the dowhatis data as intended.
PatR [Fri, 11 Dec 2020 13:10:43 +0000 (05:10 -0800)]
add the hardcoded menu control keys to key help
'? k' shows menu controls in a fancy layout and '? i' lists the
same things in basic layout but both only showed the keys that
can be changed via option settings. Add <return>, <space>, and
<escape> so that all relevant keys are listed together whether
re-bindable or not. The description of <space> is accurate for
tty and curses but possibly not for other interfaces.
This also reorders how the controls are listed, moving next page
and previous page before first page and last page, and placing
invert between select and deselect rather than after both.
M-5 and M-0 were missing from the bound key handling; they still
used hardcoded digits even though the actions for plain 5 and
plain 0 can be bound to other keys these days. This implements
the M-5 variation as NHKF_RUSH2. Changing numpad from 1 to 2
or vice versa will swap the NHKF_RUN2 and NHKF_RUSH2 actions
regardless of what keys they're assigned to. I haven't done
anything for unimplemented NHKF_DOINV2 though (and am not
planning to in case someone else wants to jump in...).
This also fixes the description of the 'I' command. The extended
command name for that still misleadingly refers to "type" rather
than "class" though.