PatR [Tue, 7 Jun 2016 01:13:04 +0000 (18:13 -0700)]
more multishot
An attempt to simplify handling of missiles which stop at hero's
location (either hit or reached end of range) would have resulted
in missiles that hit the hero not being put on the map. I had
realized this earlier but for some reason didn't get around to
dealing with it before the previous commit.
PatR [Tue, 7 Jun 2016 00:42:58 +0000 (17:42 -0700)]
multishot by monsters, plus reformatting
Some reformatting of the recently added pet ranged attack code.
The redundant--but different--multishot volley code has been replaced
so that there are only two versions (hero and monster) instead of
three (hero and monster vs hero and pet vs other monster). The monst
version was out of date relative to post-3.4.3 changes to the hero one.
The pet version was way out of date and had some bugs: wielding an
elven bow gave a +1 multishot increment to volley count for fast weapon
even when throwing something rather than shooting arrows, wielding any
weapon which had at least +2 enchantment gave 1/3 enchantment bonus to
volley count when throwing instead of shooting shoot ammo, and a pet
which got killed in the midst of a multishot volley--perhaps by a gas
spore explosion or some other passive counterattack--would keep on
shooting/throwing until the volley count was exhausted.
Pet use of ranged weapons is not ready for prime-time. Pets don't
hang on to missiles or launchers+ammo, they just drop them if there is
no target immediately available.
PatR [Sun, 5 Jun 2016 21:50:30 +0000 (14:50 -0700)]
tiles fixup: zap beams
Just noticed that a change of mine to src/drawing.c 2.5 weeks ago
("zap beam symbol descriptions -- they aren't walls") triggered a
set of four complaints when processing tiles.
PatR [Sun, 5 Jun 2016 13:33:42 +0000 (06:33 -0700)]
dat/keyhelp for vms
Update vms/install.com (rather than Makefile.top) to install the new
data file for the 'whatdoes' command.
Also, the 3.6.0 distribution puts version number 3.5.0 into vms
binaries (all the programs, not just nethack itself). It's something
observable with native tools without running the program, nothing to
do with nethack's 'v' command which gets its version number from
patchlevel.h via makedefs.
PatR [Sun, 5 Jun 2016 08:09:52 +0000 (01:09 -0700)]
'whatdoes' command and new file: dat/keyhelp
Make the whatdoes ('&' or '?f') command support the 'altmeta' option
for meta-characters generated by two character seqeunce 'ESC char'.
Also, make it be more descriptive when reporting "no such command"
by including the numeric value it operated on when failing to match
any command. That might provide a way for us to get some extra
information when players report problems with odd keystrokes: we ask
them to type such at the "what command?" prompt and then tell us what
numbers come up.
It's been given a help file to deal with assorted idiosyncracies
which can come up when querying what keys do. Unfortunately that
ended up being way more verbose than intended.
Installation of the extra data file has only been done for Unix.
Other platforms will get "can't open file" if they respond with
'&' or '?' to the "what command?" prompt. The command will still
work though, just without the extra text.
PatR [Sat, 4 Jun 2016 13:06:20 +0000 (06:06 -0700)]
more /? of spaces
Restore the ability to look up a single space by 'name'.
I thought mungspaces("<all spaces>") kept one space, but it doesn't.
It's a lucky accident that unnaming monsters and objects still works.
There may be other places which intend to give a special meaning to
a single space that don't still work....
PatR [Fri, 3 Jun 2016 00:11:13 +0000 (17:11 -0700)]
farlook bullet-proofing
When examining a buried object (after detection has revealed it),
suppress setting of its dknown bit when hero is adjacent. [That
couldn't actually happen, because the glyph on the map that we're
trying to examine would be replaced by one for whatever is on the
surface when sighted hero moved next to it, and an earlier clause
in the same test prevents blinded hero from getting to this point.]
PatR [Thu, 2 Jun 2016 08:08:34 +0000 (01:08 -0700)]
detection revamp
Change most instances of detection to offer the player a chance to
move the cursor around on the map so that the getpos() autodescribe
feature can explain things that might go away as soon as the
current detection completes. The few instances that don't offer
such a chance are the ones where everything which has been revealed
will still be there once the action finishes (such as regular magic
mapping and blessed/persistent monster detection).
There were quite a lot of inconsistencies in things like handling
for detection while swallowed or underwater. I didn't keep track
of them to distinguish between 3.6.0, current dev code, or my patch
in progess. They should be much more consistent now but without a
comprehensive fixes36.1 entry.
Blessed clairvoyance (divination spells at skilled or expert) now
shows monsters as well as terrain. I first had it like that for
any clairvoyance, but having getpos/autodescribe kick in every 15
or 30 turns once you have the amulet--or pay the appropriate amount
to a temple preist--was nearly unplayable. When it only follows an
explicit spell cast it is not intrusive.
PatR [Thu, 2 Jun 2016 01:45:52 +0000 (18:45 -0700)]
obscure polyself message
Hero was poly'd into a hider monster and was swallowed by something.
Attempting to hide via '#monster' gave "You can't hide while you're
being held." It correctly blocked hiding due to u.ustuck but the
feedback ignored the possibility of u.ustuck+u.uswallow.
PatR [Tue, 31 May 2016 13:37:14 +0000 (06:37 -0700)]
more door/chest trap detection
Make the '^' command catch up with far-look as far as identifying
trapped doors and trapped chests revealed by confused gold detect.
You need to be blinded when approaching the '^', otherwise as soon
as you can see a door or chest or whatever else is there the fake
bear trap will be removed from the map.
PatR [Tue, 31 May 2016 12:35:56 +0000 (05:35 -0700)]
wishing fix
rnd_otyp_by_namedesc() had an off by one error when choosing which
matching item to return, making it impossible to successfully wish
for the Amulet of Yendor, always yielding the plastic imitation.
n == 2, maxprob == 2
prob = rn2(maxprob); => 0 or 1
i = 0; while (i < n - 1 && (prob -= ... + 1) > 0) i++;
always exited the loop on the first test of the condition because
subtracting 1 from 0 or 1 never yielded a result greater than 0.
It's still suboptimal: "amulet of yendor" should find an exact match
and should never return "cheap plastic imitation of amulet of yendor"
from the partial match.
I think biasing the choice among multiple candidates based on their
generation probabilities only makes sense when all the candidates are
within the same class. If scroll of light occurred in 5% of scrolls
and spellbook of light occurred in 10% of spellbooks (both percentages
pulled out of thin air), having "light" get a 2 out 3 chance to be a
spellbook doesn't seem right because scrolls are four times more
likely than spellbooks (in most of the dungeon; books aren't randomly
generated at all on the rogue level or in Gehennom).
PatR [Tue, 31 May 2016 11:44:21 +0000 (04:44 -0700)]
fix #H4353 - monster gets angry after being killed
...by thrown potion. The reported case was a shopkeeper killed by
system shock from thrown potion of polymorph, but any death (acid,
burning oil explosion, water against iron golem, holy water against
undead, demon, or werecritter) to any peaceful monster could cause
similar result.
PatR [Tue, 31 May 2016 07:08:17 +0000 (00:08 -0700)]
detecting chest and door traps
When confused gold detection finds a door trap or a chest trap, it
puts a bear trap glyph/tile on the map at that location. (They
disappear once they're within sight.) Those should be given their
own glyphs so that they can have their own tiles, but this doesn't
do that. What it does do is describe such fake bear traps as
"trapped door" or "trapped chest" when examined with far-look.
The '^' command--if used while blind so that '^' hasn't disappeared
yet--needs to catch up: it says "I can't see a trap there" when the
adjacent '^' is a fake bear trap.
PatR [Tue, 31 May 2016 00:56:47 +0000 (17:56 -0700)]
getpos moving to 'cmap' characters
While testing something I noticed that moving the cursor to visible '^'
by typing '^' while getpos was asking me to pick a location, it didn't
always cycle through all visible traps. The most straightforward
culprit was after trap detection (via confused gold detection, not ^F)
had found a trap door or level teleporter in a closet that itself was
a secret corridor spot. But it turned out to be any location that
hadn't been seen yet. This is a substantial overhaul of the relevant
code and so far works for all the cases I've tried, but there are
bound to be cases I haven't tried yet and those may or may not work
correctly.
There's also a bunch of formatting cleanup, and some simplification of
the m/M/o/O/d/D/x/X handling.
PatR [Mon, 30 May 2016 00:24:47 +0000 (17:24 -0700)]
knox level tweaks
The level teleport arrival regions (which also apply when invoking the
W quest artifact's temporary magic portal) on the Ft.Ludios level had
the wrong bounding coordinates.
While there, I've added a corridor between the welcome/zoo room and
the empty room at the top. The doors are secret so monsters won't be
able to use it until they've been discovered by the player (which
happens with magic mapping as well as with searching). I put a giant
in the formerly empty room, and made that room's original door secret
too so that the giant won't smash it down to get out, then smash down
the door between the zoo room and the main area around the fort.
PatR [Sun, 29 May 2016 02:54:19 +0000 (19:54 -0700)]
reset travel cache when changing levels
When travel fails to reach its destination, it remembers the target
spot to use as default next time. But that spot is only meaningful
on the current level. Discard last travel destination when moving
to a different level.
Also, discard unlocking context when changing level unless the
context is for a container being brought along (after having been
picked up since you can't unlock a carried box). Previously, a
door pointer on the new level could happen to match the last one
being unlocked on the old level.
Discard trap setting context when changing level even if the trap
object is brought along.
Somehow the code for applying a touchstone got inserted in between
two sections of code for applying a trap (ages ago; probably since
touchstone was first introduced however many versions back), so
clean that up.
PatR [Sat, 28 May 2016 07:51:54 +0000 (00:51 -0700)]
black&white lava
Add MG_BW_LAVA to mapglyph() instead of hijacking MG_DETECT. Used
to display lava in inverse video if color is disabled and lava is
using the same display character as water (which is the default).
(The use_inverse option must be enabled for tty to honor it. X11's
text mode doesn't care. Win32 does care but probably shouldn't--it's
not a case like tty where the hardware might not support it.)
This implements both MG_DETECT and MG_BW_LAVA for X11, but only if
the program is built with TEXTCOLOR enabled. Those should work even
when color is not supported, but I suspect that configuration is
unlikely to ever be used so didn't want to spend the time to figure
out how to do it. (The relevant data is overloaded on the color
data, so not available when TEXTCOLOR is disabled.)
PatR [Sat, 28 May 2016 01:39:17 +0000 (18:39 -0700)]
number_pad:-1 qwertz keyboard
Reported almost exactly one year ago by a beta tester proofreading
the Guidebook, the number_pad setting to support the German keyboard
which swaps the Y and Z keys is for a keyboard that is used in other
places too. The report mentioned France and Belgium; Wikipedia's
"keyboard layout" entry mentions "Germany, Austria, Switzerland and
other parts of Central Europe". This changes references to "German
keyboard" (there were only a couple) into "QWERTZ keyboard".
PatR [Fri, 27 May 2016 01:35:27 +0000 (18:35 -0700)]
'^O' command documentation and '^' command help
While looking for things in core which might conceivably trigger the
Windows ctype assertion failure (haven't found any yet), I noticed
that help_dir() was still treating ^O as a wizard mode-only command.
Also, documentation about that command was never brought up to date.
I wish this change to ^O hadn't been done. #overview already has
a meta/alt M-O shortcut and overloading wizard mode commands makes
documentation more complicated since wizard mode stuff traditionally
has been left unmentioned.
PatR [Thu, 26 May 2016 00:25:47 +0000 (17:25 -0700)]
unix mail cleanup bulletproofing
If the recently added release routine ever gets called twice for
some reason, don't free already freed memory, or worse, was freed
here and then allocated for something else which is still in use.
PatR [Wed, 25 May 2016 08:09:45 +0000 (01:09 -0700)]
more #H4347 - corpse revival
When a stack of N corpses is hit by wand or spell of undead turning,
1 revives and N-1 remain corpses. If owned by a shop, a fee for
using up all N corpses was charged and if carried at the time, the
extra N-1 became owned by the player but if on the floor, they
remained owned by the shop. Feedback was schitzophrenic as to
whether the whole stack was involved:
One of the <foo> corpses glows irridescently.
You owe <shk> X zormids for them.
Split the stack so that revival explicitly operates on only 1 corpse.
It's done after the revival side of things has already succeeded or
given up, so the split will never need to be undone.
PatR [Wed, 25 May 2016 01:00:57 +0000 (18:00 -0700)]
fix #H4347 - revival of carried corpse in shop
Zapping wand of undead turning at self while inside a shop and
carrying a corpse caused the shopkeeper to claim a use-up fee for
the corpse regardless of whether it was owned by the shop.
Not mentioned in the report: casting stone-to-flesh as self while
carrying a figurine or statue behaved similarly.
PatR [Mon, 23 May 2016 00:29:59 +0000 (17:29 -0700)]
potential ctype.h issues
A few things which might conceivably pass negative values to ctype
routines. Some are post-3.6.0. None of them explain the sporadic
Windows assertion failure.
Using tolower() without verifying the argument isupper() should be
completely safe when tolower() is a function but might not be when
it's a macro. (Likewise for toupper() without islower().) NetHack's
lowc() function is always safe, at least for ASCII.
PatR [Sun, 22 May 2016 01:25:16 +0000 (18:25 -0700)]
mon->mhp manipulation
I've hunted for other instances where monster hit points were set
to zero or less without calling the routine that kills off the
monster (see recent mon_unslime() vs zhitm()) and didn't find any
for mhp subtraction. I haven't checked for direct assignment yet.
For a while I thought I'd found several cases where a monster was
intended to be killed but got left with positive hit points, but
it turned out that lifesaved_monster(), of all places, was setting
them to zero. I've moved that to its callers so that it isn't so
well hidden. And changed several ''if ((mon->mhp -= dmg) <= 0)''
into separate subtraction and 'if' just so the mhp manipulation is
a bit more visible.
I think the only actual change here is the message for monster
being killed by lava, where glass golems now melt instead of burn.
Pasi Kallinen [Sat, 21 May 2016 08:29:39 +0000 (11:29 +0300)]
Add sample config file
Several people seem to be confused about config file and what to
put in it. Perhaps this'll help a bit. The options are mostly
in alphabetical order, except where it makes sense to group
them together.
PatR [Sat, 21 May 2016 07:11:19 +0000 (00:11 -0700)]
Guidebook tweaks
Fix a typo in the text for encumbrance in the Status section.
Fix a typo in Guidebook.mn for non-fatal status condtions that
resulted in bold font for the entire Stun/Conf/Hallu line.
For Guidebook.ps, force
Status
Hunger:
onto two lines instead of being bunched up together on one line.
(For Guidebook.txt, it's already two lines.)
For both Guidebook.txt and Guidebook.ps, force some extra vertical
separation between the set of one-letter commands and the set of
extended commands, between the set of extended commands and the
set of Meta-key commands, and between the set of Meta-key commands
and the extra one-letter commands available when number_pad is on.
I don't know whether Guidebook.tex's output would look better with
something similar.
PatR [Sat, 21 May 2016 00:24:18 +0000 (17:24 -0700)]
far-look which swallowed
Change description of area outside of the swallow animation from
"interior of a monster" to "unreconnoitered". For the animation
characters themselves, don't suppress the list of other screen
features which use the same character ('/' for wand and so on).
Add a data.base entry for "unreconnoitered" in case someone tries
to use it to look up an unfamiliar term.
PatR [Fri, 20 May 2016 01:12:45 +0000 (18:12 -0700)]
zap beam symbol descriptions
They aren't walls.
Noticed while working on a potential change for far-look while
swallowed, zap beams have a bogus description of "wall" that
showed up when looking at '/' and '\\'. I'm guessing that vbeam
and hbeam were cloned from actual wall symbols and then lslant
and rslant got cloned from them. There doesn't seem to be any
other reason for the description, which is both wrong and applies
to symbols which aren't on the screen at a time when the player
can use far-look to examine them. It's been this way since the
creation of the second cvs repository used to start the current
git one; I didn't attempt to go back any farther than that.
PatR [Wed, 18 May 2016 23:36:18 +0000 (16:36 -0700)]
fix #H4343 - obscure tty bug while swallowed
When --More-- was written to leftmost column of line 2 while the
hero was swallowed, after player acknowledged it and the top line
was cleared, the cursor ended up in the wrong place. I still
don't understand what in the world is going on here, but adding
'flush_screen(0)' after 'swallowed(1)' in docorner() makes the
problem go away. Why is the behavior different when --More-- is
in the first column than when it's anywhere else?
After that fix, I commented the whole thing out. The swallowed
optimization is just not significant enough to justify peeking at
core internals.
Core bit: prior to those two changes, I tried inserting 'bot()'
into swallowed(). It moved the mis-positioned cursor from the
end of the second status line to on the map just right of the
bottom right corner of the swallowed display. That didn't fix
anything, but I've left it in place. bot() to update status is
needed following cls(); now it happens before redrawing the map
instead of at some point after.
PatR [Wed, 18 May 2016 08:49:56 +0000 (01:49 -0700)]
fix bz451 - non-sequitur role prompt
For OPTIONS=role:Valk,race:!human,align:!lawful (where first+second
contradicts third or vice versa), you'd get
Shall I pick your Dwarven Valkyrie's for you?
where the what-to-pick field names are empty. Now, align:!lawful
gets overridden, producing
Shall I pick your Dwarven Valkyrie's alignment for you?
and then you'll end up lawful regardless of whether you answer yes
or no. That may be suboptimal but does emphasize that the original
alignment constraint couldn't be honored. (Things just fell out
that way and I haven't tried to make it behave any other way.)
While testing the fix, I noticed that OPTIONS=role:Valk,race:random
prompted
Shall I pick your Valkyrie's race and alignment for you?
instead of honoring 'race:random' without asking, so I've tried to
fix that too.
Role selection has become insanely complex, so one or the other of
these fixes has probably broken some other permuation of partial
specification. Both of the changes here have been done in the core
without touching any interface-specific role selection code.
PatR [Wed, 18 May 2016 01:21:02 +0000 (18:21 -0700)]
corpse_chance()
It was hard to test the attempting-to-revive-shopkeeper-corpse
fix when dying shopkeepers kept declining to leave corpses. Make
shopkeepers always leave corpses (modulo various circumstances
which prevent all corpses). I don't know whether or not temple
priests ought to receive the same treatment.
PatR [Wed, 18 May 2016 01:10:31 +0000 (18:10 -0700)]
fix 'crash when reviving shopkeeper'
Reported directly to devteam, zapping wand of undead turning at a
shopkeeper's corpse would cause a crash. 'Traits' to fully recreate
the shk were attached to the corpse, but the temporary monster
created on the map intended to be relaced by the shk didn't have any
eshk struct, and the sequence replmon() -> replshk() -> inhishop()
attempted to access mtmp->mextra->eshk when trying to reattach the
shk to his/her shop. No other mextra structs involve pointer fixups,
so pets, priests, vault guards don't need extra handling.
I tested four cases. #1 and #3 had no shop bill at the time; I'm not
sure about #2. These all worked.
1) shk killed inside shop, resurrected there;
2) killed outside shop on the shop level, resurrected there;
3) killed inside his shop, corpse carried to different level before
being resurrected;
4) killed and resurrected on different level from shop after hero
stole something (teleported out of shop with unpaid item)--shk
left shop to chase hero and followed him/her up some stairs.
PatR [Sat, 14 May 2016 23:57:56 +0000 (16:57 -0700)]
implement #H4340 - indirect kills vs pacifism
Implement the suggestion that a monster killing itself with acid
to avoid turning to stone or with fire to avoid turning into green
slime not break pacifist conduct even if the player caused the
"turning into" situation that triggered the accidental suicide.
Along the way I discovered a serious bug: zhitm() applies damage
to target monster but leaves it to caller to finish killing off
that monster when damage is fatal, but muse_unslime() called it
without checking whether the monster should die. For fire breath
that shouldn't matter since all fire breathers are immune to fire
damage, but when support for wands of fire and fire horns was
added later it just cloned the fire breath code and neglected to
check for fatal damage. The result was that a monster with 0 HP
would be left on the map, then impossible "dmonsfree: 1 removed
doesn't match 0 pending" would be given when taking it off fmon
list, but a stale monster symbol (presumably level.monsters[][]
pointer too) was left on the map which eventually led to monsndx
panic or arbitrary crash.
PatR [Sat, 14 May 2016 11:02:07 +0000 (04:02 -0700)]
farlook when underwater
Replace "dark part of a room" with something more sensible when
examining the map while underwater where water/lava/ice within the
3x3 grid centered on the hero is all that can be seen. Adjacent
non-water, non-lava, non-ice spots are now described as "land".
(Note: this stuff doesn't apply on the Plane of Water where being
underwater gets handled differently.) Spots outside that 3x3 grid
are now described as "unreconnoitered", which sounds a bit odd but
I couldn't come up with anything better. "Not visible" is accurate
when the hero can see but needs adjusting when he can't, bringing
us right back to the current conundrum. I suppose "not accessible"
might be viable but nitpickers would consider it to be inaccurate
if hero has teleport capability. (There are a couple of references
to "unknown" from earlier versions of this revision. I think
"a ghost or unexplored or unknown or land or air (land)" is the only
place left where the player might see it, and it seems reasonable
there, although perhaps it ought to be changed to "unreconnoitered".)
Also fix farlook while swallowed and blind, where blindness was
overriding swallower Id even though it doesn't do so for mon_nam()
and things which use that like combat feedback.
PatR [Sat, 14 May 2016 09:13:07 +0000 (02:13 -0700)]
different fix for #H4332 - Qt crashes upon quit
Quiting without ever examining inventory caused the Qt interface
to issue an impossible(), then crash due to deferencing a Null
pointer. The prior fix was to suppress the validation code that
was crashing. This changes things so that the inventory window
always gets at least one use, allowing the Qt validation code to
succeed. tty and X11 are ok with it; win32 needs to be verified.
PatR [Sat, 14 May 2016 02:16:18 +0000 (19:16 -0700)]
use of #terrain while underwater
View the regular map, as originally intended, when using #terrain
while underwater. Doing so means you can't see an underwater object
underneath an adjacent critter by viewing map+traps+objs (without
monsters), but being able to see the level map instead of just the
8 adjacent squares is more valuable.
PatR [Fri, 13 May 2016 14:22:08 +0000 (07:22 -0700)]
water vs lava
When underwater, map adjacent lava as lava rather than as "not water".
The Valkyrie quest has lava adjacent to water and the hero ought to
be able recognize it while immersed so she doesn't try to climb out
of water directly into lava.
When the color option is disabled and lava uses the same symbol as
pool or as water (which is the case for default ascii, DECgraphics,
and IBMgraphics), apply the detected-monster display effect to lava.
For tty, this will draw it in inverse video if the use_inverse
option is enabled. (Assumes non-tty will nearly always be using
color so not care.) Creating a separate mapglyph special attribute
for B&W lava instead of overloading MG_DETECT ought to be done but
I didn't want to modify any interface code.
PatR [Fri, 13 May 2016 01:57:10 +0000 (18:57 -0700)]
autodescribe for #terrain
Requested during beta-testing however long ago: want a way to
look at specific map locations while #terrain is showing them
without monsters and/or objects and/or traps being displayed in
the way. The post-3.6.0 autodescribe feature for getpos() made
this pretty easy to achieve, although the lookat() aspect felt
more like trail-and-error than careful design.
Instead of putting up a --More-- prompt, ask the player to pick
a location with the cursor. Moving the cursor gives the terse
description for every location traversed. Actually picking a
spot just ends #terrain and goes back to normal play.
PatR [Fri, 13 May 2016 01:00:29 +0000 (18:00 -0700)]
detection/#terrain fix for u.uinwater
Discovered while working on an enhancement to #terrain....
Various detect magic (objects, food, &c) performed while underwater
temporarily removes the hero from the water in order to have access
to the regular map. In 3.4.3, a hangup save during the detection
would leave the hero standing on top of the water. 3.6.0 added a
flag to track should-be-underwater so that during a hangup save the
hero could be put back in when going into the save file. It also
added #terrain, another situation that uses the remove-from-water
hack while manipulating the map.
The flag wasn't being cleared after use, only during save, so normal
play without a hangup left it pending until next regular save. The
result being that after restore, the hero would be considered to be
underwater again regardless of current location, and the map display
would be limited to a view of the adjacent spots as if underwater.
Then, any move--even using '.' to rest--would notice that the
'underwater' hero was not at a water location and put things back to
normal, with feedback of "you are on solid land again." So to the
player, this would seem like a pair of map display and nonsequitor
message issues, not the internal logic one it actually is.
PatR [Thu, 12 May 2016 00:55:33 +0000 (17:55 -0700)]
nutritution consumption/starvation tweaks
Being polymorphed into a creature capable of eating metal objects
was treated as if the hero didn't/couldn't eat. Treat it the same
as being able to eat ordinary food instead.
Being fainted or unconscious from other than sleep both ran
metabolism at full rate, unlike being asleep which skips per-turn
consumption 9 times out of 10 (but retains periodic ring/amulet
and hunger/regeneration/conflict consumption). Switch to 'Unaware'
to handle sleep, unconsciousness other than sleep, and fainted
from lack of food as one metabolic condition. Being paralyzed
isn't included but maybe should be.
Changing how metabolism operates when fainted changes the amount
of time until starvation occurs, so I adjusted that by an arbitrary
amount. It will probably need tuning. As things stand, you'll
still faint umpteen times before starving, bringing about lots of
frustration since the player can't do much during that time.
PatR [Wed, 11 May 2016 22:10:33 +0000 (15:10 -0700)]
fix #H4332 - Qt crash upon immediate quit
Put in Ron Vaniwaarden's fix for crash occuring if player quits
right after choosing a character and declines to disclose anything.
Just a guess, but deleting the never-viewed inventory window might
be the cause. (3.4.3 didn't delete it.)
There's a small amount of reformatting, but cleaning that up
manually is a monumental task.
PatR [Tue, 10 May 2016 22:59:22 +0000 (15:59 -0700)]
more angry god vs pacifist conduct
Do it properly, using the arguments to xkilled() instead of reversing
the conduct counter after the fact.
The xkilled() flag value of '1' has been reversed. It used to mean
'display message' but now means 'suppress message' since both of the
other flag bits are for suppression. All callers have been updated
to specify either XKILL_GIVEMSG or XKILL_NOMSG so the underlying
number remains transparent.
PatR [Tue, 10 May 2016 01:56:31 +0000 (18:56 -0700)]
fix bz424 - cannot wish for different size globs
Globs of pudding maintain an item quantity of 1 but vary in size
based on weight. xname() formats with prefix of "small", <nothing>,
"large", and "very large" depending upon weight but wish processing
didn't recognize the prefix strings and reported "nothing fitting
that description exists". Make wishing handle "small" (which is
actually the default), "medium" (since <nothing> isn't the default),
"large", and "very large". They get ignored if the item isn't a
"glob of {gray ooze, brown pudding, black pudding, or green slime}".
Also, clean up recently added rnd_otyp_by_namedesc().
PatR [Mon, 9 May 2016 23:21:35 +0000 (16:21 -0700)]
fix #H4333 - angry god vs pacifist conduct
When you're swallowed, an angry god trying to zap you will kill
the engulfer and hero gets credit (experience) and blame (possible
loss of luck and/or alignment if engulfer is peaceful or tame) for
the act. But hero didn't actually kill the critter, so don't
increment the kill counter that monitors pacifism.
I think there are other circumstances where hero gets credit and/or
blame for something he or she didn't directly do, but offhand I
can't think of them. They might warrant similar treatment.
Tidying of xkilled() triggered by malformed block comment which is
actually a hybrid of an end of line comment (the boulder one, not
the 'dest' parameter one)....
PatR [Mon, 9 May 2016 00:56:52 +0000 (17:56 -0700)]
option parsing buffer overflow vulnerability
The report that parse_config_line() could overflow its buffer
when passed a long value from parse_config_file() was already
fixed for 3.6.1, but longer config lines mean that later stages
of option parsing need to be aware of the possibility of lines
longer than BUFSZ. This fixes the three special options which
deal with regular expressions. Autopickup exceptions, message
types, and menu coloring all could exceed BUFSZ when formatting
a value to put in the menu for 'list' or 'remove' of existing
entries. Menu colors could overflow by an arbitrary amount,
message types by up to 13 bytes, and autopickup exceptions by
just 1 byte.
Both tty and X11 seem to cope with long menu entries (wider
than can be displayed but not exceeding BUFSZ) by truncating.
For menu colorings, that hides the color and highlight attribute
since those are placed after the regexp.
Menu line truncation for tty was straightforward, just chopped
a big chunk off the end of the long string. For X11, it did
that too, taking off a lot less but ending up with much of the
menu hidden off the left edge of the screen. Dragging it into
view showed that the width fit the whole screen (or possibly
fit the width of the map, which was also as wide as the screen).
So the initial position is being miscalculated.
PatR [Sun, 8 May 2016 01:39:36 +0000 (18:39 -0700)]
options bit
I glanced over the options parsing looking for issues, and it
seems that paranoid_confirm:long-string-of-junk might have been
vulnerable. So this fixes that.
PatR [Sun, 8 May 2016 00:26:01 +0000 (17:26 -0700)]
cursed potion of levitation
Reported directly to devteam 7-Jan-2016, two issues with cursed
potion of levitation:
1) the go-up-stairs effect for cursed potion still let you choose
not to escape the dungeon if it occurred on level 1 stairs. I've
left that as-is; perhaps there's a gate across the entrance.
2) both the go-up-stairs and bonk-head-on-ceiling effects were
skipped if the hero was already levitating. I don't know whether
that was intentional but there was no comment explaining why, so
I've changed it to happen regardless of whether already levitating.
In the process, I changed the head-bonk case to do more damage when
a helmet is worn:
old: no helmet 1..10 hp, any helmet 1 hp damage;
new: no helmet 1..10 hp, soft hat 1..6 hp, hard helmet 1..3 hp.
Also, not in the report: when you aren't already levitating you
get the "you float up" message, but for cursed potion there was
never any corresponding "you float down" message because you ended
up not levitating. Now you'll levitate for 1 turn and float down
on the next, landing in a trap if one is present.
PatR [Sat, 7 May 2016 23:32:25 +0000 (16:32 -0700)]
hack.c formatting
Triggered by a couple of mis-formatted block comments in spoteffects.
Much of the diff is adding braces to the 'if' portion of things like
if (test)
statement;
else {
block-of-statements;
}