Commit Graph

6030 Commits

Author SHA1 Message Date
Pasi Kallinen
3bbf12d8b5 Minor code reorg in gather locs 2016-05-28 13:52:53 +03:00
PatR
6459b5d301 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.)

The win32 revision is untested.
2016-05-28 00:51:54 -07:00
Pasi Kallinen
4341be8c89 Merge branch 'tung-infinite-travel-fix' into NetHack-3.6.0 2016-05-28 09:51:14 +03:00
Pasi Kallinen
332780763e Merge branch 'infinite-travel-fix' of https://github.com/tung/NetHack into tung-infinite-travel-fix 2016-05-28 09:50:20 +03:00
PatR
cb14aa332d 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".
2016-05-27 18:39:17 -07:00
PatR
5987c62468 getpos of doors
Using 'd' to cycle through door locations is worthwhile when #terrain
is executing as well as when picking a location.
2016-05-27 16:10:03 -07:00
Pasi Kallinen
d51db5a992 Make getpos for doors also target drawbridges 2016-05-27 18:47:56 +03:00
PatR
49da8b87d8 '^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.
2016-05-26 18:35:27 -07:00
Pasi Kallinen
962610f365 Reset dooridx too 2016-05-26 17:58:17 +03:00
PatR
5b85a16436 level_difficulty comment: Wizard's Tower
Add a comment addressing something I recently mentioned in the
newsgroup.
2016-05-25 17:31:57 -07:00
PatR
b8d1f44272 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.
2016-05-25 17:25:47 -07:00
PatR
656476e409 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.
2016-05-25 01:09:45 -07:00
PatR
955c53eba5 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.
2016-05-24 18:00:57 -07:00
Pasi Kallinen
caafec1bc7 Separate permonst valid location humidity function 2016-05-23 22:19:43 +03:00
Pasi Kallinen
fdc1889d0d Allow quick pick doors and doorways in getloc 2016-05-23 21:03:10 +03:00
Pasi Kallinen
3b38c75517 Free mailbox at exit 2016-05-23 17:18:24 +03:00
Pasi Kallinen
e37da61b30 Fix valgrind complaints of uninitialized memory 2016-05-23 16:21:36 +03:00
PatR
bc91a01fdd 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.
2016-05-22 17:29:59 -07:00
PatR
c1bfa1360f 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.
2016-05-21 18:25:16 -07:00
Pasi Kallinen
29e9179ca5 Minor tweakage of the sample config 2016-05-22 00:00:06 +03:00
Pasi Kallinen
f556009458 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.

Also add fixes36.1 to the Files
2016-05-21 11:29:43 +03:00
PatR
47cf4a7bd1 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.
2016-05-21 00:11:19 -07:00
PatR
4e31180933 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.
2016-05-20 17:24:18 -07:00
PatR
1a47273ad5 formatting: tab removal 2016-05-20 17:01:40 -07:00
PatR
a908367fef win/tty/topl.c formatting bit 2016-05-20 16:42:03 -07:00
Pasi Kallinen
d9fabb9642 Unify monster use healing potions checks 2016-05-20 20:35:02 +03:00
PatR
6a11dace8e 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.
2016-05-19 18:12:45 -07:00
PatR
6c0489cb1b mon digging lint 2016-05-19 17:34:00 -07:00
Pasi Kallinen
2ea8666583 Interrupt a multi turn action if hp or pw is restored to maximum
via UnNetHack by Patric Mueller
2016-05-19 22:04:10 +03:00
Pasi Kallinen
d11241f61e Add more lighting variance to bigroom v2 2016-05-19 20:57:56 +03:00
Pasi Kallinen
0db1e1ca38 Unify pet and monster digging item checks 2016-05-19 18:46:29 +03:00
Pasi Kallinen
de716ec533 Unify shop location stocking test 2016-05-19 18:05:54 +03:00
PatR
23f5526c35 shop_keeper bit
This started as formatting cleanup but ended up adding a bit more
useful information if the impossible ever gets triggered.
2016-05-18 18:13:01 -07:00
PatR
fccd29dfd4 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.
2016-05-18 16:36:18 -07:00
PatR
a242e0d892 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.
2016-05-18 01:49:56 -07:00
PatR
05557ee068 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.
2016-05-17 18:21:02 -07:00
PatR
24400cdca4 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.
2016-05-17 18:10:31 -07:00
PatR
094f393378 role parsing lint 2016-05-14 18:34:15 -07:00
PatR
26226a1cdb misc core formatting
Some of these are post-3.6.0, some just got overlooked before the
3.6.0 release.
2016-05-14 18:26:48 -07:00
PatR
0a15d425a8 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.
2016-05-14 16:57:56 -07:00
PatR
81471c27ca 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.
2016-05-14 04:02:07 -07:00
PatR
0bd13a7a8c 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.
2016-05-14 02:13:07 -07:00
PatR
cce85939b5 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.
2016-05-13 19:16:18 -07:00
PatR
f768e1fd51 water vs ice
Like lava, see/feel adjacent ice when underwater.  Unlike lava,
no special display hacks involved.
2016-05-13 08:48:27 -07:00
PatR
888695c328 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.
2016-05-13 07:22:08 -07:00
Pasi Kallinen
166cbd4434 Fold character race/role/gender/align option parsing into single function 2016-05-13 16:43:27 +03:00
Pasi Kallinen
cf8520cbb1 Fold role ability switches into single function 2016-05-13 11:41:04 +03:00
PatR
dccc818801 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.
2016-05-12 18:57:10 -07:00
PatR
088c47a427 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.
2016-05-12 18:00:29 -07:00
PatR
43df8c0130 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.
2016-05-11 17:55:33 -07:00