Commit Graph

4677 Commits

Author SHA1 Message Date
PatR
8728de2a0a fix #H8330 - kicking obj stack uses wrong weight
Kicking a stack splits off one item (except for gold coins) and
propels it, but the range for how far it would move was calculated
before the split using the entire stack's weight.  So a large stack of
small items might fail with "thump" (which the report suggested hurt
the hero, but it doesn't) and none of the stack would move.  Splitting
sooner looked complicated because of several potential early returns
between the range calculation and the eventual kick, so this hacks the
stack's quantity to get the intended weight instead.
2019-03-06 16:59:39 -08:00
PatR
e2b6cf4066 fix #H8319 - hero-owned container used inside shop
showed non-empty containers in inventory (including the one being
applied) with a 'for sale' suffix during put-in operations, as if the
shop was trying to sell it to the hero.  Amount shown was cumulative
value of its contents.  (Using /menustyle:T doesn't show the container
being applied so this wasn't visible with it unless other non-empty
containers were being carried.)

Two or three fix attempts solved one problem but introduced another.
This one seems to finally get things right but considering that there
was trial and error along the way, my confidence isn't great.
2019-03-04 14:40:01 -08:00
PatR
b211c1b832 fix #H8310 - riding a saddled tripe ration
If steed ate a mimic corpse and started mimicking an object or dungeon
furniture, the hero was able to keep riding.  Force a dismount when
that happens, even if steed takes on monster shape rather than object
or furniture.  After that, #ride to remount non-monster will fail
unless using wizard mode's "force mount to succeed" action, in which
case steed's eating finishes immediately and it returns to normal.

This doesn't address the older report that mounted hero can continue
to move around while the steed is eating.
2019-03-01 18:32:41 -08:00
PatR
7664d604da fix #H8297 - healer vs undead turning
Report forwarded from spam filter so not included in bugzilla list.
Make corpse revival feedback be more consistent.  Some of the healer-
specific flavor is still there.
2019-02-28 15:12:12 -08:00
nhmall
6a81d78c56 Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2019-02-26 19:53:42 -05:00
nhmall
be3092bed4 some fish should lay their eggs in the water rather than on land
Generally, fish should lay their eggs in the water and
not on land, but the game was only allowing the opposite.

Eels are catadromous and lay their eggs in the Sargasso Sea,
not in the dungeon.
2019-02-26 19:49:24 -05:00
PatR
1a028d1197 curses run-time options
This started out as an attempt to document the curses options in the
Guidebook, but I didn't actually get that far.  Instead, integrate
the curses options better via more consistent WC/WC2 usage.  This
prevents 'guicolor' from showing up as a boolean option for non-curses
interface in curses+other binary.

For curses itself, let 'petattr' be set/reset via 'O'.  Also, accept
'Dim' as a possible pet highlight attribute since it already handles
all the other ordinary attributes.  I'm not sure what leftline and
rightline highlighting are supposed to do.  They were missing for
ncurses (or maybe they're misspelled for PDcurses?) but adding them
didn't produce any visible effect (using TERM=xterm-256color on OSX
with default font/character set).

Not addressed:
1) general confusion about compile-time vs run-time option filtering;
2) curses pet highlighting only works if 'color' option is enabled.
2019-02-26 15:16:42 -08:00
PatR
5a432d0c97 toggling persistent inventory window
Something else noticed while testing #H8271:  toggling perm_invent on
with 'O' didn't show anything (at least with curses) until some later
action caused it to be updated.  Make updating persistent inventory be
included with full redraw and set the need_redraw flag when toggling
perm_invent.
2019-02-25 15:48:29 -08:00
PatR
4df491e47d more wearing armor vs perm_invent window
Realized while fixing #H8271:  if persistent inventory got an update
while wearing or taking off was in progress (not within user's control
since hero is busy) the item in question was flagged as "(being worn)"
even though it wouldn't be worn if putting on got interrupted.  Update
doname() to show "(being donned)" or "(being doffed)" instead of
"(being worn)" when corresponding operation is in progress. (During
testing, I was able to observe "being doffed" but never managed to see
"being donned".)
2019-02-25 15:44:21 -08:00
PatR
2b2106743e fix #H8271 - wearing armor vs perm_invent window
A relatively recent change moved 'obj->known = 1' when wearing armor
from before setworn(), which issues an update_inventory() call, to
afterwards.  There wasn't any particular update then, so observing
the enchantment of armor by wearing it wasn't being reflected in the
persistent inventory window if that was enabled.
2019-02-25 15:33:43 -08:00
nhmall
587a51bee7 include isaac64 in xcode build 2019-02-24 14:35:49 -05:00
PatR
e0db41572a more bz 1604 - re-do vs autoquiver
Take another crack at describing yesterday's do-again fix.  Having
'autoquiver' enabled wasn't necessary to encounter the problem.
Also, 'in_doagain' is an int rather than a boolean.
2019-02-22 12:54:39 -08:00
nhmall
fb14c283c3 fix typo in comment 2019-02-22 09:00:53 -05:00
PatR
2579a3dcbb fix #H8237 - corpse on an invalid trap
It's possible to get a rolling boulder trap which doesn't have any
boulder.  That isn't invalid, but if/when it happens on a shallow
level it shouldn't be covered by the corpse of a fake adventurer
since such a trap won't kill anyone.
2019-02-21 17:53:19 -08:00
PatR
9c4a6afe46 fix bz 1604 - re-do vs autoquiver
One-line fix is much shorter than attempting to describe the problem.
^A could misuse previous input if 'f'<direction> needed to fill the
quiver and there was nothing suitable, so that the sequence became
'f'<what to throw>.  If previous <direction> was an inventory letter
that was occupied, and the item it that slot wasn't already worn in
some other slot, it would be put in quiver slot.  Then player would
be asked for direction rather than immediately throwing it since the
what-to-throw prompt had just used up the last of the ^A queue.

Miscellaneous formatting included....
2019-02-21 13:28:18 -08:00
PatR
48ea357266 poly'd hero movement
Noticed while fixing the 'monster intrinsics from worn gear' bug(s):
set_uasmon() calls set_mon_data(&youmonst,...) which updates movement
when the monster polymorphs into something slower, then it did the
same thing to youmonst.movement itself, hitting the hero with a double
dose of reduction for any movement points not yet spent on current
turn.  Remove the set_uasmon() side of that, and change set_mon_data()
side to add a redundant non-zero test to prevent static analysis from
warning that it might be dividing by 0.
2019-02-18 13:24:58 -08:00
PatR
a6ff7210be fix #H8215 - monster intrinsics from worn gear
Fixes #177

The monst struct has 'mintrinsics' field which attempts to handle
both mon->data->mresists and extrinsics supplied by worn armor, but
polymorph/shape-change was clobbering the extrinsics side of things.
Potentially fixing that by changing newcham() to use set_mon_data(...,1)
instead of (...,0) solved that but exposed two other bugs.  Intrinsics
from the old form carried over to the new form along with extrinsics
from worn armor, and update_mon_intrinsics() for armor being destroyed
or dropped only worked as intended if the armor->owornmask was cleared
beforehand--some places were clearing it after, so extrinsics from worn
gear could persist even after that gear was gone.

So, fixing the set_mon_data() call in newcham() was a no go.  This
fixes update_mon_intrinsics() and adopts the suggested code from
github pull request #177 to have mon->mintrinsics only handle worn
gear instead of trying to overload innate intrinsics with that.  This
is a superset of that; the flag argument to set_mon_data() is gone
and mon->mintrinsics has been renamed mon->mextrinsics.  (The routine
update_mon_intrinsics() ought to be renamed too, but I didn't do that.)
2019-02-18 13:17:14 -08:00
PatR
109a9707ae array lint
Suppress a diagnostic from the VMS compiler that the '&' in '&array'
has no effect.
2019-02-13 16:11:23 -08:00
PatR
a41d63d146 fix #H8183 - leather jacket doesn't show AC
Leather jacket doesn't take multiple turns to wear, so wearing it
wasn't calling Armor_on() and recently moved 'uarm->known = 1' didn't
get executed.  Not reported yet but had the same issue:  fedora and
dented pot wouldn't call Helmet_on().
2019-02-12 15:40:05 -08:00
PatR
4bb5560961 more #H8167 - late messages
Do late message suppression in a different fashion.  Also, there are
more messages than shk taking hero's possessions and guard taking
hero's gold that need to be suppressed if regular message delivery
is no longer possible:  "do not pass Go", "you arise from the grave
as a foo", "the corridor disappears", "you are encased in the rock".
Those last two are from vault handling but take place in a convoluted
manner:  paygd -> mongone -> grddead -> clear_fcorr.
2019-02-11 13:39:34 -08:00
PatR
f3e7f49714 fix #H8167 - shopkeeper message after ending game
Closing nethack's window sets 'program_state.stopprint' to inhibit
disclosure interaction, but shopkeeper claiming hero's stuff or vault
guard claiming hero's gold didn't honor that and just issued normal
pline messages.  For win32, they got delivered in a popup even though
nethack's window had gone away.

Make those two end-of-game situations honor 'program_state.stopprint'.
[Fix not tested on win32...]
2019-02-10 17:45:26 -08:00
PatR
f067a3e9ff compiling isaac64.c
Revise isaac64.c so that it can be compiled unconditionally and
yield nothing if USE_ISAAC64 isn't defined.  Necessary for building
via vmsbuild.com.
2019-02-10 13:41:45 -08:00
PatR
16dc5870cb comment typo 2019-02-09 16:27:51 -08:00
PatR
128d1628a9 fix #H8124 - interrupted donning gives player info
about the armor.  Wearing armor sets obj->known, making its enchantment
be shown when it gets formatted, because the AC value on the status line
lets the player deduce what that is.  It was being set at the beginning
of the wear operation.  If the armor got stolen before it became fully
worn, the enchantment was still shown.  Defer that until the end of the
operation.  An attentive player can still deduce the enchantment if the
item is stolen (because its protection starts immediately) but the hero
won't learn that enchantment unless the donning completes.

This might be suboptimal but it isn't qualitatively different from
watching a pet walk/not-walk over items whose bless/curse state isn't
known or dropping unidentified items in a shop to check their price.
The player can deduce something that the hero doesn't know yet.
2019-02-09 16:07:18 -08:00
PatR
2d62513b1b minor nitpicks
A couple of trivial things I noticed while looking at status cleanup.
2019-02-09 15:33:16 -08:00
PatR
8c1e499f8b armor comments
I don't see the #H8124 bug getting fixed any time soon, so add a
comment about it since the relevant place is unambiguous.

No change in code except removing a couple instances of 'register'.
2019-02-05 14:49:43 -08:00
PatR
423cf77a37 more message history
Noticed while investigating the issue with DECgraphics characters in
msg_window:full/combination/reverse output for tty which got fixed
by the previous commit.  There was a discrepancy in DUMPLOG because
the pager code bypasses pline() in order to use putmixed().  tty
puts strings from the latter into ^P recall history (although they'll
only render correctly if nothing after the first character needs
special handling), but nothing was putting that same info into
DUMPLOG.  This fix is pretty clumsy but eliminates the discrepancy.
2019-02-04 18:40:55 -08:00
PatR
190c90e95e tty ^P message recall
Extend 'putstr(WIN_MESSAGE, attribute, string)'s attribute so that
'custompline(SUPPRESS_HISTORY, ...)' can work with ^P's message
history like DUMPLOG history, in order to keep autodescribe feedback
and intermediate prompts for multi-digit count ('Count: 12', 'Count:
123') prompts out of recall history.  The old autodescribe behavior
could easily push all real messages out of the recall buffer when
moving the cursor around for getpos, and the count behavior looked
silly for a four or five digit gold count if you set the msg_window
option to 'full' or 'combination' and viewed them all at once.

Other interfaces may want to follow suit, but this doesn't force them
to make any changes.  I added a hook for "urgent messages" that might
be rendered in bold or red or some such and/or override the use of
ESC at --More-- from suppressing further messages, but there aren't
any custompline(URGENT_MESSAGE, ...) calls (potentially "You die...",
for instance) to exercise it.  Other people have implemented similar
feature it different ways and I'm not sure whether this one is really
the way to go since the core needs to categorize each message that it
deems to be urgent.  MSG_TYPE:stop may be sufficent, although MSG_TYPE
matching can entail a lot of regexp execution overhead at run-time.
2019-02-04 16:46:04 -08:00
PatR
3896fcff8b function call through pointer
There be others of these.  Don't for ANSI C for something this simple.
2019-02-04 15:01:36 -08:00
PatR
cb7f873733 goodtype() reversal
Reverse an erroneous part of the vault guard commit.
2019-02-03 14:08:29 -08:00
PatR
7cc718ea0e fix #H7173 / github #101 - vault exit
Fixes #101

If you tell the vault guard your name, drop carried gold, wait one
turn, then pick up the gold again, the guard will move a step away
during the wait.  If you teleport away, the guard will seal vault
walls and then park himself on the one-square (so far) temporary
corridor adjacent to the vault wall.  Periodically he'll say "Move
along!" and the hero will hear it, regardless of location on the
level.  Unless you dig a corridor to rescue him, or one or more of
the vault's walls get breached again, he will never move.

The report emphasized that you could use this to steal the vault's
gold, but it relies on being able to teleport beyond the gaurd's
reach and if you can do that, you might as well do so before the
guard comes.  The stranded guard, and him saying "Move along!" when
no longer leading hero out of the vault, are more significant bugs.

Bonus fix:  if the game ends and the guard seals up the vault while
the hero is in a spot that gets fixed up (vault wall or temporary
corridor) don't give the "You are encased in the rock" message if
game end was due to death rather than quit.
2019-02-02 17:37:06 -08:00
PatR
b43b3f617c object classes for wizard mode identify
When ^I was changed to allow picking more than one item to make
its temporary identification become persistent, group accelators got
left out.  So to pick all potions, you needed to select them letter
by letter (or via '.' to select everything, then deselect non-potions
letter by letter).  Now you can use '!' to select all potions.
2019-02-01 18:40:45 -08:00
PatR
6daa6e2de9 curing deafness
Make healing magic which cures blindness also cure deafness.  So,
drinking non-cursed potion of healing or any extra healing or full
healing; breathing fumes from blessed potion of healing or non-cursed
potion of extra healing or any potion of full healing; prayer reward
to cure blindness as a minor trouble.  (Doesn't affect unicorn horns
which already treat deafness and blindness as two distinct troubles
that are eligible to be cured.)

More of a missing feature than a bug fix, so I listed it in the new
features section of the fixes file.
2019-02-01 18:24:23 -08:00
Pasi Kallinen
9f1ae0fe74 Fix making fake leash object with leashmon set
When farlooking at a leash glyph on a map, the fake object should never
have leashmon set. This happened when a mimic was on the same spot
and was mimicing a corpse or statue, due to leashmon and corpsenm
using the same field.
2019-02-01 18:19:04 +02:00
Pasi Kallinen
adacde80e7 Fix logic error in stuck_in_wall 2019-02-01 13:38:21 +02:00
PatR
8bf16b940e stale lock picking context
Lock context wasn't being cleared if it was for a container and that
container got destroyed.  Case discovered was forcelock() ->
breakchestlock() -> delobj() (sometimes the container is destroyed
rather than just breaking its lock) followed by #wizmakemap (replace
current level) and maybe_reset_pick() trying to check whether
xlock.box was being carried.  But being interrupted, destroying the
container or dropping it down a hole to ship it to another level, then
attempting to resume picking the lock would also find a stale pointer.
2019-01-31 15:50:12 -08:00
Pasi Kallinen
7bbc1f0130 Fix warning
Fix "using integer constants in boolean context"
2019-01-31 21:31:29 +02:00
PatR
48e7643739 fix monstone() ... dealloc_obj() panic
Fuzzer feebdack.  When turning a monster into a statue, monstone()
builds a linked list of mon->minvent items to put into that statue.
It doesn't use obj_extract_self() to take them off again, leaving
obj->nobj non-Null.  Not noticed for the normal case where each item
gets linked into the container's contents, but triggers panic if an
item merges with something already put inside so gets removed.

Suddenly, the dungeon collapses.
dealloc_obj with nobj
[2] 0x01000c4193 panic + 995
[3] 0x0100155427 dealloc_obj + 71
[4] 0x010021d4de obfree + 686
[5] 0x01000f2f92 merged + 834
[6] 0x010015356e add_to_container + 126
[7] 0x01001628ac monstone + 636

I don't know why the petrified monster's mergeable inventory wasn't
already merged while in inventory.
2019-01-31 04:22:04 -08:00
Pasi Kallinen
8736141f68 Option handling return values and errors
Fix some options not stopping when encountering an error,
some didn't show up any errors, and other minor fixes.
2019-01-31 10:46:44 +02:00
PatR
409343e8eb another warning fix
Only appeared when ISAAC64 was disabled.
2019-01-30 16:25:31 -08:00
nhmall
6e0d55dfbc rng bit 2019-01-30 11:08:11 -05:00
PatR
39b6a7e515 another warning fix
Comparison between signed and unsigned.  Compiler stupidity since
the range of possible values that signed 'i' can take is limited and
never negative.
2019-01-29 15:18:17 -08:00
PatR
1b49f60ded warning fix
The new code provoked several warnings; this fixes one of them.
Moving the declaration of 'rolecount' would have been sufficient,
but I've gone another way.
2019-01-29 15:00:07 -08:00
nhmall
57f03eca1b Merge branch 'alex-and-isaac' into NetHack-3.6.2-beta01 2019-01-29 07:20:17 -05:00
Alex Smith
0c96dd6a22 Consistently use rn2 in trap detection
It's a gameplay-affecting action (it updates the character's
memory of the map), and there's no way to spam it without using
resources, so rn2 is safe.
2019-01-29 03:37:08 +00:00
nhmall
54062e0ad6 include the rnd.c bits 2019-01-28 19:54:18 -05:00
nhmall
457e4b68aa merge Alex's dual rng proposal with the isaac64 rng code and adjust
This is branched from Alex's hallu-rng-stability branch,
with two build corrections (detect.c, zap.c), and merged
with  the isaac64 branch that we have ready to go.

Alex's dual rng is supported by setting up the array
of multiple isaac64 contexts.

I stuck with Alex's approach of passing the rng function
name around as the parameter (rng or rn2_on_display_rng)
for the new additional parameter needed for
set_random(), init_random(), reseed_random(),
and init_isaac64().
2019-01-28 19:43:55 -05:00
nhmall
819ee796f2 Merge branch 'countermeasures' into alex-and-isaac 2019-01-28 18:37:50 -05:00
PatR
30237c73ec fix #H8072 - failing wish segfaults
Having an artifact wish be refused uses zeroobj and code which
followed was attempting to update its weight, triggering a segfault
now that zeroobj is 'const'.
2019-01-28 09:10:52 -08:00
Patric Mueller
bd730dbcaa workaround for C89 not supporting inline 2019-01-28 15:00:04 +01:00