Pasi Kallinen [Mon, 19 Nov 2018 19:27:19 +0000 (21:27 +0200)]
Long worm may get killed in middle of action
If long worm attacks you, and you have a passive response that may
kill the worm (eg. blue jelly), the worm may die in the middle of
a loop checking for a worm segment that can attack. This'll cause
a segfault because the worm segments will get freed.
Pasi Kallinen [Mon, 19 Nov 2018 19:24:08 +0000 (21:24 +0200)]
Moving long worms may still put tail in old location
When using rloc and friends to move monsters, and the monster
happens to be a long worm, the tail may get randomly placed
in the same place where the long worm was removed from.
In the cases where we expect the location to really be free,
explicitly recheck the location for a monster after rloc.
Pasi Kallinen [Sat, 17 Nov 2018 17:59:09 +0000 (19:59 +0200)]
Fix vault guard not considering monsters in walls
Two different cases here: a) Vault guard did not move away monsters
except if they were standing on gold, and b) moving away monsters
on a completely filled level did not work
Pasi Kallinen [Sat, 17 Nov 2018 17:26:49 +0000 (19:26 +0200)]
Fix freeing monsters not on map
Sometimes we free the monster data, but the monster is not on the
map - usually this happens if the map is full of monsters and a new one
is migrated on the level.
Make m_detach check the monster x coordinate, so it knows not to touch the map
if the monster isn't on it.
PatR [Mon, 19 Nov 2018 02:48:59 +0000 (18:48 -0800)]
fix #H7573 - impossible zero payment in money2mon
When paying for shop door or wall damage, if the entire amount was
covered by shop credit then impossible "zero payment in money2mon"
would occur as the shop code tried to transfer 0 zorkmids from hero
to shopkeeper after using credit to pay.
PatR [Sun, 18 Nov 2018 00:40:53 +0000 (16:40 -0800)]
src/ formatting
Clean up quite a bit of minor things found with simple grep patterns:
operator at end of continued line instead of beginning of continuation
(and a few comments which produced false matches, so that they won't
do so next time), trailing spaces (only one or two of those), tabs (a
dozen or so of those), several casts which didn't have a space between
the type and the expression (I wasn't systematic about finding these).
I think the only code change was in the function for the help command.
PatR [Sat, 17 Nov 2018 02:49:12 +0000 (18:49 -0800)]
feedback for missing readonly data files
If bogusmon, engrave, epitaph, oralces, or rumors won't open, assume
it's because the file is missing so don't have impossible() tack on
"saving and restoring might fix this" when telling the player.
(Missing rumors or oracles previously only used pline() rather than
impossible() so this hadn't been an issue for them. Now it would be.)
PatR [Fri, 16 Nov 2018 23:34:09 +0000 (15:34 -0800)]
more vms (vmsbuild.com vs monstr.c)
Apparently I exited emacs without saving and the revised vmsbuild.com
ended up as a backup file that 'git nhadd' wouldn't see. This was
supposed to be included in the patch committed several hours ago....
PatR [Fri, 16 Nov 2018 17:16:48 +0000 (09:16 -0800)]
vms build/install update
New-ish files 'engrave', 'epitaph', and 'bogusmon' added for 3.6.0
were not handled by playground setup. NetHack runs without them so
limited testing didn't notice.
Add 'makedefs -s' to build them and include them in installed files.
Bart House [Fri, 16 Nov 2018 05:42:23 +0000 (21:42 -0800)]
Remap unicode control codes.
When running NetHack.exe in a console set to code page 850, the
multi-byte to wide character mapping will generate unicode values
in the unicode control code range. These values need to be re-mapped
to unicode renderable glyphs using the same mappings we use for
control page 437 otherwise the console font might not render a character
for these unicode control values.
nhmall [Thu, 15 Nov 2018 07:34:45 +0000 (02:34 -0500)]
stale gold symbol displayed after symset change
a stale gold symbol could be displayed on the status line following a switch
to a new symset, as observed and reported for Windows RogueEpyx symset.
An update is required for gold in the status line for a change to
any of the following:
context.rndencode value
the encoded glyph value for COIN_CLASS
the gold amount
PatR [Thu, 15 Nov 2018 01:26:10 +0000 (17:26 -0800)]
X11 menu searching
I was experimenting with some potential changes to menu searching but
have not been satisfied with the result. However, this bit of code
consolidation is worthwhile regardless of that.
PatR [Thu, 15 Nov 2018 01:18:12 +0000 (17:18 -0800)]
X11 resource defaults
Some of the items in NetHack.ad were separated from others by "!"
comment line rather than plain blank line and that tended to make it
look like the two items were directly related. For the ones which
aren't, remove '!'.
I also expanded some comments and reordered a couple of resources,
moving 'slow' closer to top and advanced 'translations' farther down.
PatR [Wed, 14 Nov 2018 00:29:48 +0000 (16:29 -0800)]
fix #H7536 - pet vampire behavior
Vampires tend to take vampire bat form and stay that way, unless/until
there's a closed door they want to pass in which case they change to
fog cloud form. Those shifted forms are weak, so pet vampires tend
not to attack other monsters, and if they don't take damage, they
won't change to vampire form. So, when comparing relative strength of
self and foe while deciding whether to attack another monster, treat
their own strength in weak form as if in vampire form, making them be
more aggressive.
Hostile vampires shouldn't need any comparable change. They don't use
relative strengths when deciding whether to attack something.
PatR [Tue, 13 Nov 2018 23:05:54 +0000 (15:05 -0800)]
fix github issue #159 - eating nurse corpses
Fixes #159
The nurse monster definition is flagged to be able to convery poison
resistance when a corpse or tin is eaten, but the post-corpse code
for nurse healed HP and cured blindness then skipped the intrinsic
handling.
PatR [Mon, 12 Nov 2018 19:02:40 +0000 (11:02 -0800)]
conflicting countdowns again
Use the make_foo() intrinsic set/reset routines instead of trying
to manipulate the intrinsics directly. Previous patch left Dex
down by 1 if stoning caused wounded legs to be fixed, and left
delayed killer allocated if stoning cured sliming or vice versa.
PatR [Mon, 12 Nov 2018 10:13:32 +0000 (02:13 -0800)]
conflicting countdowns
I tried 'pick all' in the #wizintrinsics' menu and after 30 turns,
died with "poisoned by a poisoned, while vomiting". Food poisioning
and/or terminal illness beat the other fatal conditions to the coup
de gras. However, the final stage of vomiting sets Sick to 0 cure
food poisoning and ends up clobbering the killer reason if Sick is
due to terminal illness. It's feasible for that to happen without
using #wizintrinsic, so this fixes that, and also a few other
combinations that seemed contradictory:
1) limbs turn to stone during Stoned countdown now cures wounded legs;
2) turn to stone (a couple of turns later) cures vomiting and sliming;
3) turning to slime during Slimed countdown cures stoning.
Bart House [Mon, 12 Nov 2018 09:58:56 +0000 (01:58 -0800)]
Enforced the inclusion of windows headers before nethack headers.
Moved the code page 437 mapping table to winnt.c so that it could be
used in window and console clients.
Added check that fonts support unicode values we use from code page 437.
Use unicode to draw text if font supports it otherwise use ASCII.
PatR [Mon, 12 Nov 2018 00:04:45 +0000 (16:04 -0800)]
prayer vs blocked by boulder
Salvaged from an old, unfinished patch. When checking whether the
hero is trapped by walls and solid rock, adjacent boulders are
evaluated on whether they can be pushed out of the way. Extend that
evaluation: (1) two boulders on a spot are pushable if there is a
pool beyond that spot, and (2) boulders can't be pushed diagonally
in Sokoban.
PatR [Sun, 11 Nov 2018 22:28:54 +0000 (14:28 -0800)]
fix #H7065 - clairvoyance shows trap over monsters
and over the hero. 3.6.0's clairvoyance tried to show things in
a non-standard sequence, which was intentional but had unintended
side-effects like the disappearing monsters complained about in the
report. To make it work as intended would have required --More--
whenever it kicked in, which is much too intrusive when it happens
every N turns rather than when explicitly casting the spell.
Redo it substantially, and give preference to monsters over objects,
objects over traps, and traps over underlying terrain like normal
vision-based display does. It now detects all monsters within its
bounding box but shows ones which aren't directly in view as
"unseen monster" unless via spell cast at skilled or expert, or at
basic when also having intrinsic clairvoyance.
PatR [Sun, 11 Nov 2018 02:22:38 +0000 (18:22 -0800)]
couple of #wizintrinsic fixes
When #wizinstrinsic was expanded to be able to set any timed attribute,
some that need more than just a timeout counter were left inconsistent.
1) Timed Flying wasn't blocked by levitation, and existing flight
wasn't becoming blocked by timed levitation. Also, eventual flight
timeout wasn't updating the status line, so false 'Fly' condition
remained shown until a status update happened for some other reason.
2) Setting timer for Warn_of_mon didn't set up any type of monster to
warn about so wouldn't do anything. This sets that to grid bug
unless already set due to polymorph form or artifact that warns.
PatR [Sat, 10 Nov 2018 09:37:23 +0000 (01:37 -0800)]
otransit_msg() fixes
Fixes #156
githib issue #156 complains that "The Excalibur falls down the stairs,"
is using poor grammar despite the fact that the usual drop message is
"You drop the +0 Excalibur." I agree. Change it to be "Excalibur
falls down the stairs." (Drop message remains unchanged.)
While looking at that, I noticed that when knocking other items down
stairs, text was being appended to the formatted object name. It was
probably safe due to the space reserved for inserting a prefix while
formatting an object's name, which becomes available for a suffix
after that name has been copied into otransit_msg()'s local buffer,
but using a separate buffer is safer.
PatR [Fri, 9 Nov 2018 23:43:50 +0000 (15:43 -0800)]
impossible worm_cross non-adjacent location
Attempting to mount a long worm tail could yield
\#ride -> mount_steed() -> test_move() -> worm_cross() ->
impossible("worm_cross checking for non-adjacent location").
PatR [Thu, 8 Nov 2018 23:33:03 +0000 (15:33 -0800)]
build and bug fixes for USE_OLDARGS
New: call to panic() in impossible() used arbitrary string as a
format so was vulnerable to percent signs in that string. (This
potentially serious problem is not limited to USE_OLDARGS.)
Old: revised message string for impossible ("save/restore might fix
this" instead of "perhaps you'd better quit") passed wrong number of
arguments to pline() when using the clumsy VA_PASSx() mechanism (was
missing arg 0 for the fixed-arg format argument).
Old: varargs config_error_add() in files.c wouldn't compile for
USE_OLDARGS. Evidently no one has been impacted by that but this
fixes it anyway. (Two problems: prototype used FDECL() when it
should have been using VDECL(), and calls to config_error_add() in
the same file would need the VA_PASSx() stuff to force presence of
all optional args. I moved it instead of adding the latter.)
Pasi Kallinen [Thu, 8 Nov 2018 13:50:53 +0000 (15:50 +0200)]
Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
PatR [Wed, 7 Nov 2018 22:50:44 +0000 (14:50 -0800)]
^X about armor
Enlightenment feedback for "nudist" was added 3.5 years ago. Ever
since, ^X has been reporting "you are not wearing any armor" when
wearing a shield without any other armor.
Since Valkyrie starts in that situation, it's very surprising that no
one ever noticed 'til now (or did notice and didn't bother to report).
PatR [Sun, 4 Nov 2018 06:17:49 +0000 (23:17 -0700)]
removing all items via 'A' when looting container
Followup to 'fix #148' patch: looting a container with menustyle:Full
wasn't offering a chance to remove everything in one go. That was due
to an error I introuduced 2.5 years ago with commit 529dad8ef15d255e00ba2d75dd9a92d5030d97f5 when I changed how the flags
passed to query_category() were being set up. It accidentally switched
'A' from take-out to put-in but the only code to handle 'A' at that
time would take everything out (from container to inventory).
Prior to that, removing everything worked as intended and putting in
everything wasn't supported. Now 'A - autoselect all' is a viable
choice for both in and out.
PatR [Sun, 4 Nov 2018 00:45:31 +0000 (17:45 -0700)]
fix github issue #154 - #loot in A-autoselect all
Fixes #154
With menustyle:Full, picking 'A - autoselect all' when putting items
into a container ran code for taking things out and there wasn't any
corresponding code for putting things in.
Add some put-in-everything code. Taking things out doesn't offer
'A - autoselect all' as a choice so the code mentioned above may now
be dead. Taking everything out seems like something that's much more
likely to be desired than putting everything in.
PatR [Sat, 3 Nov 2018 09:01:11 +0000 (02:01 -0700)]
yet another ^X revision...
Hopefully this will be the last one. Change from a text window to
a menu so that it is possible to scroll backwards (without needing
scrollbars) via '^' and '<' keys. End of game disclosure for
attributes still uses a single-forward-pass text window.
Also, move the recently added weapon proficiency line from the new
'basic' section to right after the "you are wielding" line at the
end of the 'status' section.
PatR [Fri, 2 Nov 2018 07:59:01 +0000 (00:59 -0700)]
^X again
Add a new line for one last missing status field: gold.
Also add one for proficiency with current weapon.
Move a few lines from 'characteristics' to 'background' and a few
more from 'characteristics' to new 'basics', leaving characteristics
with the six original characteristics: Str, Con, Dec, &c.
PatR [Fri, 2 Nov 2018 00:37:47 +0000 (17:37 -0700)]
fix #7501 - searching while blind
My "fix github issue #38 - indentation vs 'if {}'" patch, commit d2ae45984ed9d007112e1de3aa65fc6c04773fdf, broke finding unseen
monsters via searching. Most notable if blind, but applied to
invisible monsters too.
nhmall [Wed, 31 Oct 2018 12:49:18 +0000 (08:49 -0400)]
watchmen at genocide prompt
Report stated:
type "watchmen" into a genocide prompt, it says no such creatures exist in the world
type "watchman" and it says "wiped out all watchmen"
PatR [Sun, 28 Oct 2018 23:03:42 +0000 (16:03 -0700)]
fix github issue #148 - life-save while swallowed
Life-saving was setting u.uswldtim to 0, presumably intending that
to stop the hero from being digested, but it actually resulted in
being totally digested on the swallower's next turn if the death
being short-circuited wasn't digestion. Change life-saving to make
swallower or grabber release the hero instead of tinkering with
u.uswldtim. In addition to rescuing the hero from digestion, it
prevents an eel which has just drowned the hero (who has survived
drowning via life-saving) from pulling him/her back into the water
on its next turn. It will need to make another successful grab to
do that now.
While testing, I noticed that if I was polymorphed and wearing an
amulet of unchanging, life-saving didn't restore my HP-as-a-monster
and due to the recent change to force that to 0 when the hero dies,
I died again immediately after my life was saved. So this bug was
latent in the past and became noticeable in the last couple of days.
PatR [Sun, 28 Oct 2018 02:55:18 +0000 (19:55 -0700)]
fix #H7487 - dead with non-zero HP
Report was for being fried by angry deity. There are lots of deaths
that don't involve subtracting HP until it hits 0 or less; I haven't
bothered tracking down which ones don't set u.uhp to 0 before they
call done().
No effect on life-saving or declining to die except for HP:0 being
visible on the status line during their messages.
PatR [Sun, 28 Oct 2018 02:26:56 +0000 (19:26 -0700)]
X11 menu tweaks
Restore handling for keystrokes on PICK_NONE menus so that scrolling
via keys works for them. (That handling was disabled as part of the
patch to support MENUCOLORS.)
Enable [cancel] button for all menus. (That had apparently been
grayed out for PICK_NONE menus since day 1 for X11 windowing.)
nhmall [Sat, 27 Oct 2018 23:18:27 +0000 (19:18 -0400)]
fix Guidebook.tex processing due to wrong brace used
[36] [37] [38] [39] [40] [41] [42] [43]
! Extra }, or forgotten \endgroup.
l.4602 ``{\tt up}'' and ``(\tt down}
'' set the field attributes for when the...
Pasi Kallinen [Sat, 27 Oct 2018 10:51:32 +0000 (13:51 +0300)]
X11: Reuse menu code to display files
Previously the code used the ASCII Text Athena widgets for displaying
file contents. Unfortunately, the widget made it impossible to control
scrolling or pretty much anything else.
Use the menu code instead, making the file display window behave properly.
PatR [Sat, 27 Oct 2018 10:45:18 +0000 (03:45 -0700)]
provide dungeon location in ^X feedback
Dungeon level wasn't included in ^X output, so it wasn't actually
giving all status fields and attempting to rely on it when turning
off 'status_updates' was leaving a gap in feedback for the player.
Add an extra line to the first section where character's name and
patron deity are reported, giving current location.
|You are in the Dungeons of Doom, on level 5.
or
|You are in the endgame, on the Elemental Plane of Fire.
The information is more explicit than the basic status field, but
you can already get similar information via #overview so it isn't
giving away extra info.
PatR [Sat, 27 Oct 2018 07:42:11 +0000 (00:42 -0700)]
another Guidebook update - mostly NETHACKOPTIONS
Move some 'roff macros from Guidebook.mn to new file tmac.nh.
Header for tmac.nh is not being updated, even after explicitly adding
it to .gitattributes. I'm not sure what I've done wrong. (I'm using
'git nhadd doc/' here rather than explicit 'git nhadd doc/tmac.nh'.)
In Guidebook.mn, change the ``setenv NETHACKOPTIONS'' example so that
it fits within one line in Guidebook.txt. (I looked at 3.4.3's
edition of that file and the example went not just beyond the margin
of the formatted text but beyond 80 columns, so wrapped in an ugly
fashion.) I had previously changed 'autoquiver' to 'color' to shorten
it, now have changed '!autopickup' to '!leg' to show an example of
truncated option name as well as shorten, and also 'fruit:papaya' to
'fruit:lime' to squeeze out the last two columns needed to fit within
the text margin while retaining 'name:Blue Meanie' as requested.
Guidebook.txt shows both NETHACKOPTIONS examples with indentation
suppressed, Guidebook.ps uses normal indentation (evidently using a
narrower font, even with \f(CR (constant-width Roman) to approximate
TeX's \tt, since the indented example fits fine and looks better).
Some Guidebook.tex catchup. I suspect that lots of bits and bobs
don't match between Guidebook.mn and Guidebook.tex these days.
Particularly quoting and variant font (italics, bold, \tt) usage.
Also the recently added box around the sample screenshot. This
modifies the screenshot to match Guidebook.mn's, reflecting change
in status field spacing by STATUS_HILITES.
PatR [Fri, 26 Oct 2018 23:35:21 +0000 (16:35 -0700)]
fix github issue #150 - delayed encumbrance msg
Fixes #150
> A very minor one, but there are some situations where your encumbrance
> level can change, but the message (such as '`Your movements are now
> unencumbered.`') isn't given until your next move or turn, even though
> the status line updates immediately. For example, praying while weak
> and gaining a point of strength. Picking up or dropping items or
> interacting with containers does _not_ have this problem.
This is usually fixed on a case by case basis. Any attempt to add
blanket encumbrance check mid-turn (when updating status, for instance)
is sure to introduce message sequencing problems. Perhaps such a check
could be added at the end of the hero's move....
This fix handles the cases where prayer causes a change to strength:
major: fix starvation, minor: fix weak from hunger, boon: golden glow
(restore strength and satisfy hunger--probably no-ops in this regard
or would have had trouble fixed rather than receive a boon). Directly
curing stat loss (minor: poisoned) already dealt with encumbrance.
> Possibly related to the quirk whereby polymorphing into a form with
> different speed gives you one move movement at your old speed?
> (Polymorphing into a sessile monster gives you one last move.)
Not at all related. That movement bug affected 3.6.0 but was fixed in
3.6.1.
PatR [Fri, 26 Oct 2018 22:09:48 +0000 (15:09 -0700)]
fix #7470 - Sting vs webs
When trapped in a web, trying to move while wielding Sting gives the
message "Sting cuts through the web." In 3.6.1 and earler, that
also released you from the trap, but with 3.6.2-beta nothing happens.
It had nothing to do with the recent web spinning patch. My change
to have being trapped block levitating and flying included replacing
a lot of direct manipulations of u.utrap with set_utrap() and
reset_utrap() in order to keep the lev/fly blocking and unblocking
localized. Unfortunately, the old 'u.utrap = 0' when wielding Sting
while stuck in web was deleted in error at that time.
PatR [Thu, 25 Oct 2018 21:15:55 +0000 (14:15 -0700)]
stinking cloud vs drawbridge
While looking at something else, I noticed that newsym() was checking
for pool and lava by examining the terrain type directly rather than
using the pool and lava checks, so it would never show a gas cloud at
a closed drawbridge (the spot in front of the portcullis). Level's
terrain at a closed drawbridge spot is DRAWBRIDGE_UP; need to look at
drawbridgemask field to figure out whether the accessible terrain at
that spot is moat or lava.
Pasi Kallinen [Thu, 25 Oct 2018 12:58:19 +0000 (15:58 +0300)]
X11: Don't hilite the help ext menu entry
Both the "help" button at top and the "help" extended menu command
were hilighted by the X resources. Make the top buttons have
"btn_" prefix, so they're easily distinguished in the resources.