]> granicus.if.org Git - nethack/log
nethack
3 years agoFix panic on thrown potion of acid when swallowed
Pasi Kallinen [Tue, 19 Apr 2022 11:56:51 +0000 (14:56 +0300)]
Fix panic on thrown potion of acid when swallowed

When you're swallowed and throw a missile that kills the swallower,
the thrown missile is picked up by the swallower before death.
This caused a panic when you threw a potion, which was first picked up
by the swallower, which upon death dropped the potion on the floor,
but then throw code was trying to destroy the potion ...

3 years agoitem-action name/call
PatR [Tue, 19 Apr 2022 11:33:01 +0000 (04:33 -0700)]
item-action name/call

Add opportunity to name an individual object or call the type of an
object to the context-sensitive inventory item-actions.

3 years agomon_leaving_level
PatR [Mon, 18 Apr 2022 19:01:17 +0000 (12:01 -0700)]
mon_leaving_level

From 6 year old email:  m_detach (monster death or removal from play)
and relmon (monster migrating to another level) both take a monster
off the map but they weren't consistent with each other.  Change them
to use a common routine for that.

I'm not sure whether the inconsistencies resulted in any bugs.  The
email was concerned about handling for monsters that emit light, but
those aren't actually common to the two removal methods and turned
out to be ok.

3 years agoUnify mhitm magic attack negation checks
Pasi Kallinen [Mon, 18 Apr 2022 16:14:40 +0000 (19:14 +0300)]
Unify mhitm magic attack negation checks

3 years agoMinor code dedup in sp_lev
Pasi Kallinen [Mon, 18 Apr 2022 10:38:01 +0000 (13:38 +0300)]
Minor code dedup in sp_lev

3 years agomore queued commands
PatR [Sun, 17 Apr 2022 20:36:38 +0000 (13:36 -0700)]
more queued commands

This attempts to make item-actions, #herecmd, and #therecmd be more
robust.  When rhack() or yn_function() take queued input off cmdq
and get something unexpected, discard the rest of the queue.

It also fixes the two crash cases that entrez reported.  There are
bound to be others though.

I think a lot of actions that can be executed by queued input are
going to need nomul(0) calls to handle repeat counts that should be
ended early if something unexpected happens or something expected
fails to happen.  But that clears cmdq so may be tricky to decide
where to use.

3 years agodrink_ok() tweak
PatR [Sun, 17 Apr 2022 08:39:34 +0000 (01:39 -0700)]
drink_ok() tweak

Fix a comment typo and change the 'if obj/!obj' logic to be like what
was recently added to eat_ok()/offer_ok()/tin_ok().

3 years agoeating, drinking via #herecmdmenu
PatR [Sat, 16 Apr 2022 22:32:41 +0000 (15:32 -0700)]
eating, drinking via #herecmdmenu

Fix eat floor food and drink from dungeon feature via #herecmdmenu.
That uses queued commands, but those two actions were changed to
skip the floor when queued input was present because asking about
floor items interfered with context-sensitive inventory item-actions.

I was misled by a comment that says it couldn't insert an m-prefix;
that was for treating the 'm' key as typed text rather than as a
command.  There's no problem with inserting a #reqmenu command which
is what 'm' is these days.  So item actions can force 'm' to skip the
floor and go directly to inventory, also the #eat and #quaff commands
don't have to alter their behavior when queued input is pending so
the #herecmdmenu usage for them gets fixed.

3 years agoQt extended command entry
PatR [Sat, 16 Apr 2022 21:53:43 +0000 (14:53 -0700)]
Qt extended command entry

For Qt with 'popup_dialog' off, if I typed "#quit" then the prompt
"Really quit?" was displayed in the message window as expected.
But if I typed "#" and then clicked on [quit], sometimes the prompt
wasn't visible even though the program was waiting for me to answer
it.  I've noticed this a time or two in the past and just pretended
that it hadn't happened; since I usually enter extended commands by
typing their name, it didn't stand out much.  Testing #repeat with
extended commands brought it back to mind.

I don't understand what's going on, but this one-line patch seems
to solve it.  (With a multi-line message window, clear_nhwindow()
doesn't erase anything, but for Qt it does update the most recent
entry.)

3 years ago& (whatdoes) enhancement?
PatR [Sat, 16 Apr 2022 21:28:27 +0000 (14:28 -0700)]
& (whatdoes) enhancement?

Using '&#' or '?f#' showed "#  perform an extended command (##)".
The "(##)" part looks rather silly and is not helpful.  Expand the
text a little and omit command name for that particular command:
"#  enter and perform an extended command".

3 years ago\#repeat bit
PatR [Sat, 16 Apr 2022 19:38:10 +0000 (12:38 -0700)]
\#repeat bit

The comment preceding new 'savech_extcmd()' said that the core didn't
care whether it was given the full command name or just enough leading
substring to be unambiguous.  Then it tested the string against
"repeat" which contradicts that comment.  Didn't seem to be an actual
problem because "#repeat" is not flagged for auto-completion, but fix
the code to match the intent of the comment and reword the comment to
match the code.

3 years agocron job updates
nhmall [Sat, 16 Apr 2022 15:08:34 +0000 (11:08 -0400)]
cron job updates

3 years agoresolve build error on windows with vs2022
nhmall [Sat, 16 Apr 2022 12:32:13 +0000 (08:32 -0400)]
resolve build error on windows with vs2022

win/tty/getline.c(305) :
warning C4701: potentially uninitialized local variable 'ecmatches' used
win/tty/getline.c(305) :
error C4703: potentially uninitialized local pointer variable
'ecmatches' used

3 years ago^A/#repeat vs extended commands
PatR [Sat, 16 Apr 2022 08:52:12 +0000 (01:52 -0700)]
^A/#repeat vs extended commands

Fix '#repeat' for tty; both it and ^A can repeat an extended command.

Fix both for curses; they can repeat an extended command instead of
just repeating the initial '#' to start getting an extended command.

X11 (tested), Qt (tested), and probably Windows GUI (not tested)
behave the same as before:  ^A (or #repeat) after an extended command
just repeats the # to run the dialog to get an extended command.

I hope this introduces fewer bugs than it fixes but I don't think I'd
bet on that....

3 years agocontext-sensitive inventory item-action quaff
PatR [Fri, 15 Apr 2022 19:09:17 +0000 (12:09 -0700)]
context-sensitive inventory item-action quaff

Picking a potion from inventory and then picking 'quaff this potion'
from the context menu needed handling similar to eat/offer/tin:  skip
floor candidates.  If you were on a fountain or sink, picked a potion
from inventory and then the quaff option for it, you weren't prompted
to drink from the fountain but you were prompted for what potion to
drink instead of using the one that had already been picked to
initiate drinkig.

3 years ago^A fix
PatR [Fri, 15 Apr 2022 18:45:50 +0000 (11:45 -0700)]
^A fix

If you used ^A to repeat a command which had taken no time, the
repeat execution would take time.  This fixes that.  Also, give some
feedback when trying to repeat an invalid command.

Internals bit: don't use 'X == cmd_from_func(do_repeat)' to decide
whether key X is the key for #repeat.  Both X and Y might be bound to
that action and cmd_from_func() could return Y rather than X.

There is another ^A bug that I haven't figured out how to fix:
 t ESC   start to throw but don't finish
 ^A      nothing seems to happen
 ^A      "You don't have that object."
The first ^A repeats 't', doesn't display a prompt for what to throw,
but does request input for it.  The second ^A fulfills that input and
doesn't match any inventory item.  Either 't' shouldn't have been put
into the do-again buffer or do-again handling should have ceased when
it was taken out and there was no further remembered input, so that
normal prompting would resume.  My tentative attempts for both those
approaches didn't work.

3 years agofix github issue #734 - ^A crash
PatR [Fri, 15 Apr 2022 17:07:19 +0000 (10:07 -0700)]
fix github issue #734 - ^A crash

Issue #734 reported as "parse function" by Meklon2007:  the change
yesterday intended to make ^A work for commands that were preceded
by a prefix was triggering a crash if used after a keystroke that's
not assigned to any command.

'M^A' or '~^A' would segfault by derefencing a null pointer when
checking whether 'M' or '~' was a prefix.  This prevents the check
attempt from doing that, but a better fix would be to not put the
invalid command keystroke into the do-again buffer in the first
place.

Fixes #734

3 years agoRevisit the Valkyrie goal level hack
Pasi Kallinen [Fri, 15 Apr 2022 15:52:46 +0000 (18:52 +0300)]
Revisit the Valkyrie goal level hack

Instead of hardcoding the lava terrain change in core, if the stairs
are created in a fixed location, force the terrain to room floor first.
Move the surrounding lava changing to room floor to the Val-goal lua
file.

3 years agofix a comment
PatR [Fri, 15 Apr 2022 07:45:35 +0000 (00:45 -0700)]
fix a comment

At one point temp_resist() was boolean and when it was changed to
long the comment preceding it wasn't updated.

3 years agofix #K3577 - F+dir followed by ^A moved dir
PatR [Fri, 15 Apr 2022 01:59:23 +0000 (18:59 -0700)]
fix #K3577 - F+dir followed by ^A moved dir

Reported by luxidream via the web contact form and also as github
issue #732: using the repeat command after F+direction would take a
step in direction if there was no target to fight.

The direction was being repeated without the F prefix.  It wasn't
specific to F; m+dir misbehaved too.  This fix seems to work but it
should be replaced with something more robust.

Fixes #732

3 years agotemporary? fix for github issue #730 - stairs \
PatR [Thu, 14 Apr 2022 17:50:23 +0000 (10:50 -0700)]
temporary? fix for github issue #730 - stairs \

placed on lava spot on Valkyrie goal level

Reported by k2, arriving at the final level of the Valkyrie quest
can issue a recently added impossible
| mkstairs: placing stairs up on molten lava at <68,13>
The report said it was easy to reproduce, but it took me multiple
tries (so not hard to do, but not a sure thing on any given attempt).

The stairs on that level are placed at specific coordinates that
are outside the pre-mapped area, so there's no guarantee that their
spot will be suitable for stairs.  The underlying terrian changes
from lava to stair, but only after the warning about molten lava.

This hack solves that particular level but is not a general solution
for this type of thing.  When about to make stairs on a lava spot,
change that spot to normal floor first.  Plus 50:50 chance to change
each adjacent lava spot to floor too so that there's decent chance
for some elbow room upon arrival.

Also, turn the no-flip attribute off for that level so that 'fixed'
location of the stairs can occur in four different places.

Fixes #730

3 years agoFix uninitialized var in dip
Pasi Kallinen [Thu, 14 Apr 2022 15:59:03 +0000 (18:59 +0300)]
Fix uninitialized var in dip

3 years agofix github issue #731 - accessing freed memory \
PatR [Wed, 13 Apr 2022 20:34:14 +0000 (13:34 -0700)]
fix github issue #731 - accessing freed memory \

after charging causes a ring to explode

Reported by gebulmer:  if charging exploded a ring, the ring's memory
got freed but the stale pointer was passed to cap_spe() which accessed
it again.  Fix by setting the object pointer to Null after using up
the ring.  This was a post-3.6 bug.

Fixes #731

3 years agoeating/offering/tinning
PatR [Wed, 13 Apr 2022 20:03:14 +0000 (13:03 -0700)]
eating/offering/tinning

Make being offered floor food and declining behave similarly to
being offered a chance to drink from or dip into a fountain and
declining:  insert "else" into
| "You don't have anything [else] to {eat | offer | tin}."
when there is nothing applicable in inventory.

3 years agomore potion drinking/dipping
PatR [Wed, 13 Apr 2022 19:13:13 +0000 (12:13 -0700)]
more potion drinking/dipping

Simplify the recently added handling for inserting "else" into
| You don't have anything [else] to {drink | dip into}.
after declining to use a fountain/pool/sink at the spot when not
carrying any potions.

3 years ago'm' prefix for drinking and dipping
PatR [Wed, 13 Apr 2022 10:14:39 +0000 (03:14 -0700)]
'm' prefix for drinking and dipping

Allow the player to precede q/#quaff or M-d/#dip with the 'm' prefix
to skip asking about fountains, sinks, or pools if one of those
happens to be present, similar to how using it for e/#eat skips food
on the floor and goes straight to inventory.

If you use it and don't have any potions, you'll get "you don't have
anything to drink" or "you don't have anything to dip into", same as
when there is no suitable dungeon feature present combined with no
potions.  However, if an applicable dungeon feature is present and
you don't use the prefix but answer 'no' to drink from fountain,&c
and you don't have any potions, "else" will be inserted into the
message: "you don't have anything else to drink".

A big part of the diff is just a change in indentation level for
code that is now inside 'if (!iflags.menu_requested) {' ... '}'.

3 years agocontext-sensitive inventory - action sequencing
PatR [Tue, 12 Apr 2022 21:56:38 +0000 (14:56 -0700)]
context-sensitive inventory - action sequencing

rhack() normally calls parse(), parse() sets context.move to True
assuming that the player's next action will take game time, then
when it returns, rhack() sets context.move back to False if the
assumption turned out to be incorrect.  But when performing actions
after picking something in inventory, rhack() doesn't call parse()
so context.move is left at False.

This was hidden by making the inventory command take game time if
the player picked an item and set up an action to be done with it
even though the action hadn't taken place yet.  So time was being
accounted for but if the hero didn't get consecutive moves then
monsters got their turn between the shouldn't-take-time inventory
command and the ought-to-behave-like-normal-command queued action.

My initial attempt to fix this (before figuring out how context.move
works) by stopping inventory from taking time didn't work because
queued item-actions stopped taking time too, or rather the fact that
they took no time became exposed.  This second attempt doesn't have
that problem and I think it is correct.

3 years agovisual studio comment follow-up
nhmall [Tue, 12 Apr 2022 18:49:34 +0000 (14:49 -0400)]
visual studio comment follow-up

3 years agobuild tested with updated Visual Studio versions
nhmall [Tue, 12 Apr 2022 18:43:28 +0000 (14:43 -0400)]
build tested with updated Visual Studio versions

VS 2017 (Apr 12, 2022 version 15.9.46)
VS 2019 (Apr 12, 2022 version 16.11.12)
VS 2022 (Apr 12, 2022 version 17.1.4)

3 years agocontext-sensitive dipping
PatR [Tue, 12 Apr 2022 09:20:40 +0000 (02:20 -0700)]
context-sensitive dipping

Normally dipping gets the thing to dip first and what to dip it
into second and the item-action handling knows that.  I'm not sure
why that wasn't working as intended and I couldn't figure out how
to make it do that, so went another way:  this adds an internal
extended command that executes an alternate dip routine which gets
the potion to dip into first and the thing to dip into it second.

The #dip command should allow an 'm' prefix to skip fountains and
pools, similar to how eating accepts it to skip food on the floor.
But this doesn't implement that.

3 years agoshop repair revisited
PatR [Tue, 12 Apr 2022 00:53:09 +0000 (17:53 -0700)]
shop repair revisited

This repair behavior should be closer to the orginal, except without
the old sequencing issues.

3 years agocontext-sensitive invent: corpses
PatR [Mon, 11 Apr 2022 22:02:44 +0000 (15:02 -0700)]
context-sensitive invent: corpses

Picking a corpse while looking at inventory issued a menu that had
entry for eating that and if on an altar another one for offering
that.  Picking the eat or offer choice worked as long as there
weren't any other corpses on the ground or altar.  If there were
others, they'd be skipped but you'd get prompted for which item in
inventory to eat or offer instead of operating on the one that was
used to initiate the action.

3 years agoWindows keyhandling
nhmall [Mon, 11 Apr 2022 19:24:55 +0000 (15:24 -0400)]
Windows keyhandling

3 years agoinventory context: drop and wield
PatR [Mon, 11 Apr 2022 18:34:53 +0000 (11:34 -0700)]
inventory context: drop and wield

For context-sensitive actions when picking an item from inventory,
exclude drop and wield from the choices if the item is being worn.

Move 'O'ffer into alphabetical order.

Formatting: fix a couple of cases of '&&' or '||' placed at the end
of first half of a split line instead of at the start of second half.

3 years agoAdd moving on the trap to the mouse menu
Pasi Kallinen [Mon, 11 Apr 2022 12:08:50 +0000 (15:08 +0300)]
Add moving on the trap to the mouse menu

3 years agoAdd spell casting to mouse menu
Pasi Kallinen [Mon, 11 Apr 2022 11:54:12 +0000 (14:54 +0300)]
Add spell casting to mouse menu

3 years agoimplement github issue #727 - item-action '#tip'
PatR [Mon, 11 Apr 2022 09:27:03 +0000 (02:27 -0700)]
implement github issue #727 - item-action '#tip'

Issue reported by Meklon2007:  picking a container from inventory
didn't offer #tip as a possible use of the item.
Implemented in commit 7b351bc20d60aa4e70a7433fa5776a81c0f2a4b4
but I forgot to close the issue, so this adds a fixes entry for
it in order to do that.

Closes #727

3 years agoadd #tip to context-sensitive invent
PatR [Mon, 11 Apr 2022 09:18:41 +0000 (02:18 -0700)]
add #tip to context-sensitive invent

Add a menu option for #tip when selecting a container from inventory.
Also, move the recently added 'unwield' option to the order it gets
placed in the menu for primary weapon:  before 'a' because it's
spelled '-'.

3 years agoobject bypass bit sanity for container contents
PatR [Mon, 11 Apr 2022 09:16:22 +0000 (02:16 -0700)]
object bypass bit sanity for container contents

Noticed when adding a 'tip container' choice to item-actions for
context sensitive inventory (update pending).  Putting items into a
container with menustyle traditional and then takiing them out with
the #tip command while 'sanity_check' is On would produce warnings
once they were on the floor.

askchain() uses object bypassing to be able to cope with multi-drop
potentially changing invent, and it tried to reset that when done.
But it did so with the original object list (invent in this case)
and that doesn't reset individual objects that have been moved to
any other list.  The between-turn resetting of bypass bits wasn't
doing so for container contents.  The sanity check wasn't--still
isn't--checking those either, so it wasn't noticeable while items
were still inside the container.  But taking them out with #tip
doesn't touch any bypass bits, so between-turn reset isn't triggered
and the items that came out of the container with bypass set
continued to have it set while on floor.  sanity_check complained.

Change clear_bypasses() to handle container contents, and change
askchain() to call it instead of just clearing bypasses for whatever
is left of its input chain.  (The latter probably isn't necessary
now that the between-turn cleanup deals with contents.)

3 years agoWhen autopicking objects, you can count to two
Pasi Kallinen [Mon, 11 Apr 2022 08:31:28 +0000 (11:31 +0300)]
When autopicking objects, you can count to two

Show "two" instead of "a few" when autopicking up objects, and
there's some left you didn't pick up.

3 years agofix a Windows initializer
nhmall [Sun, 10 Apr 2022 21:18:48 +0000 (17:18 -0400)]
fix a Windows initializer

3 years agocontext-sensitive inventory
PatR [Sun, 10 Apr 2022 19:22:21 +0000 (12:22 -0700)]
context-sensitive inventory

Add '-' choice if player picks wielded weapon.  'w-' is effectively
the unwield command but a normal inventory list doesn't present '-'
as something that can be picked, so there's no context menu entry
that can suggest wielding it.

Make 't' clearer.  Don't offer it as a choice when selected item is
worn, distinguish between throwing and shooting, and introduce a bit
of plural handling.

Since we aren't using a magic 'A' command to "equip" and "unequip",
make the uses of P/R/T/W match up with how they normally operate so
that player can learn them while using item menus.

Do something similar for offer vs sacrifice.

3 years agogetobj vs CMDQ handling
PatR [Sun, 10 Apr 2022 19:14:07 +0000 (12:14 -0700)]
getobj vs CMDQ handling

The queued command handling rejected a non-object even in cases where
getobj()'s object callback would accept it.

3 years ago\#dotypeinv ('I') - show title for inventory subset
PatR [Sun, 10 Apr 2022 13:52:39 +0000 (06:52 -0700)]
\#dotypeinv ('I') - show title for inventory subset

When asking for an inventory subset for one of the meta-classes that
can generate output which spans object classes (so B,U,C,X, and P),
insert a title at the start of the resulting inventory list.  (Iu and
Ix produce alternate output that already includes a title.)

Also, stop handling '$' differently for menustyles traditional and
combination from full and partial.  'I$' was running the '$' command
for the first two styles but just showing the inventory entry for
gold for the last two.  Change to the latter for all styles.

3 years agoX11: set menu entries to same length
Pasi Kallinen [Sun, 10 Apr 2022 13:09:40 +0000 (16:09 +0300)]
X11: set menu entries to same length

While testing the new mouse action menus, it was quite annoying
to try and hit some shorter entries. Make all the selectable entries
the same maximum length, and with text left justified.

3 years agoFix castle engraving and scroll
Pasi Kallinen [Sun, 10 Apr 2022 11:30:55 +0000 (14:30 +0300)]
Fix castle engraving and scroll

Fixes #723

3 years agoFix erroneous test_move params
Pasi Kallinen [Sun, 10 Apr 2022 09:52:39 +0000 (12:52 +0300)]
Fix erroneous test_move params

3 years agomore shop damage repair
PatR [Sat, 9 Apr 2022 22:55:21 +0000 (15:55 -0700)]
more shop damage repair

Stop attempting to catch up for lost time for shop damage repair
when getlev() loads a previousl visited level.  Normal shopkeeper
behavior will take care of that.

Also, fixes the display related aspects of shop damage repair
interacting with ball and chain.  They don't happen when its done
while the map is being shown.

3 years agopreliminary fix for github issue #726 - restdamage
PatR [Sat, 9 Apr 2022 19:02:30 +0000 (12:02 -0700)]
preliminary fix for github issue #726 - restdamage

Reported by entrez, restoring a saved game runs the shop wall/floor
damage repair routine.  It was taking place before attached ball
and chain were fully restored so the repair routine treated them as
ordinary objects if they happened to be in a wall gap that gets
fixed on the same turn as restore takes place.  They could end up
being moved to a spot that's too far from the hero and then trigger
an impossible "b&c distance".

This restores ball and chain before shop damage repair takes place
so the repair routine deals with them sanely and the impossible won't
occur any more.  However, the repair still happens before the current
level's map has been displayed and that looks pretty strange during
the shopkeeper's message.  Also, if the hero and the ball start on
opposite sides of the gap, after the gap is repaired the ball will
still be shown as a remembered object at its old spot even though it
ends up being located at the hero's feet.

Closes #726

but more work is needed...

3 years agoformatting attached ball and chain
PatR [Sat, 9 Apr 2022 18:45:43 +0000 (11:45 -0700)]
formatting attached ball and chain

When punished, the ball gets formatted as
| heavy iron ball (chained to you)
but the chain was just "iron chain".  Since iron golems leave some
of those behind, doname() shouldn't just assume that you know which
chain is locked to your leg.  Change the formatting for uchain to
| iron chain (attached to you)

3 years agorefine setworn()'s impossible()
PatR [Sat, 9 Apr 2022 18:40:47 +0000 (11:40 -0700)]
refine setworn()'s impossible()

If setworn() issues "Setworn: mask = 1234.", format the number in
hexadecimal so that the high bits are easier to decipher.  Noticed
when experimenting with ball and chain where the decimal values of
their worn-masks are beyond the range of powers of 2 I recognize.

3 years agotry CI build with mingw-w64 release 5
nhmall [Sat, 9 Apr 2022 17:52:41 +0000 (13:52 -0400)]
try CI build with mingw-w64 release 5

3 years agofix github issue #722 - unique monster's corpse
PatR [Sat, 9 Apr 2022 17:15:34 +0000 (10:15 -0700)]
fix github issue #722 - unique monster's corpse

Issue #722 posted by copperwater and commented on by Entrez:  both
shk_your() and the() inserted "the" in front of a unique monster's
corpse, yielding "the Lord Surtur's corpse glows iridescently" and
"the Lord Surtur's corpse drops to the floor."

Teach both of those routines to skip "the" when used for monsters
with personal names.  It now omits "the" for "Medusa's corpse" but
still gives "the Oracle's corpse".

shk_your() operates on an object and can deal explicitly with corpses
of named monsters.  the() operates on text and has to guess whether
it is being used in a similar situation.  Right now the guess is just
"is there an apostrophe present?" and might need further refinement.

Fixes #722

3 years agoContext sensitive item usage from inventory
Pasi Kallinen [Sat, 9 Apr 2022 12:19:52 +0000 (15:19 +0300)]
Context sensitive item usage from inventory

Allow selecting an item from inventory and show a menu of actions
applicable for that particular item. Some of the entries might
be slightly spoilerish (eg. it'll reveal that you can read T-shirts),
but the improved usability for new players is more than worth it.

Generally known as "item actions", this was first implemented
in AceHack by Alex Smith.

3 years agoprayer timeout bit
PatR [Fri, 8 Apr 2022 21:48:55 +0000 (14:48 -0700)]
prayer timeout bit

It was theoretically possible to reduce prayer timeout by angering
your god.  I'm not sure whether that could actually happen but add
code to avoid it.

3 years agopull request #725 - detecting mimic as statues
PatR [Fri, 8 Apr 2022 17:23:54 +0000 (10:23 -0700)]
pull request #725 - detecting mimic as statues

Pull request from entrez makes object detection of statues that are
actually mimics show the statue's monster type instead of always
depicting tengus.

Fixes #725

3 years agoFix: object detection vs mimic statue disguise
Michael Meyer [Thu, 7 Apr 2022 18:54:00 +0000 (14:54 -0400)]
Fix: object detection vs mimic statue disguise

Cursed potions of object detection were showing all mimics disguised as
statues as 'i' glyphs, because object_detect used PM_TENGU as the
corpsenm of any mimic disguise.  Instead, use MCORPSENM when available
so that hidden mimics will be mapped with glyphs corresponding to their
actual disguises.

3 years agofixes entry for pull request #724 - fountain \
PatR [Fri, 8 Apr 2022 17:14:44 +0000 (10:14 -0700)]
fixes entry for pull request #724 - fountain \

detecting monsters when none are present

Give some feedback for monster detection if drinking from a fountain
fails to find any monsters.  Potion or spell gives "strange feeling"
feedback in that situation but fountain didn't report anything.

Fixes #724

3 years agoAdd message for failed fountain monster detection
Michael Meyer [Thu, 7 Apr 2022 16:51:35 +0000 (12:51 -0400)]
Add message for failed fountain monster detection

When the fountain quaffing monster detection effect was triggered on a
level without any monsters, no message would be printed.  I think this
was the only scenario where drinking from a fountain wouldn't print
anything, so it stood out as unusual.

Print a messsage in the case monster detection fails, to make it
consistent with other fountain effects and ensure it's clear the hero
did still drink from the fountain on that turn.  I used "the water
tastes like nothing" for the (sort of tenuous) connection to there being
nothing living on the level, but there might be a better message to put
in there.

3 years agopull request #721 - reset xstart,ystart
PatR [Fri, 8 Apr 2022 17:06:06 +0000 (10:06 -0700)]
pull request #721 - reset xstart,ystart

Prevent inconsistent data for #wizloadlua.

Closes #721

3 years agoMake sure xstart and ystart are always zero when not in_mklev
copperwater [Wed, 6 Apr 2022 12:00:34 +0000 (08:00 -0400)]
Make sure xstart and ystart are always zero when not in_mklev

Running #wizloadlua to run Lua scripts that use coordinates in any way
would work differently if you were on certain levels for the first time
versus leaving and returning to them. This is because various bits of
level creation routines can leave xstart and ystart set to non-zero
values, which are then zeroed at some point when leaving and returning
to the level.

Since xstart and ystart are only relevant to level creation and lua
commands, this fixes the problem by zeroing them after leaving mklev
routines. (Saving them with the level doesn't work because xstart and
ystart are relative to the last used des.map, of which there could be
multiple, e.g. in Asmodeus's level or if two map-based themed rooms
happen to generate. I can envision a more complex solution in which
every des.map used in the level can be associated with an identifier,
whose xstart and ystart are saved for use by later post-level-creation
lua scripts, but currently I just want to make them consistent between
level visits.)

3 years agopull request #720 - specifying monster gender \
PatR [Fri, 8 Apr 2022 16:54:02 +0000 (09:54 -0700)]
pull request #720 - specifying monster gender \

in lua code was ignored

I'm taking this one on faith....

Fixes #720

3 years agoFix: monster gender could not actually be specified in lua files
copperwater [Tue, 5 Apr 2022 11:55:06 +0000 (07:55 -0400)]
Fix: monster gender could not actually be specified in lua files

Noticed when I tried to create a male monster of a species that permits
both males and females (i.e. not a single-gender or neuter species),
half the time the monster ended up female anyway. This was because
get_table_montype picks a random monster gender for such species, and
lspo_monster just sets it to that, making it impossible to deliberately
have a monster of a certain gender.

This fixes that by defaulting the "female" table argument to random
instead of false, and then checking to see whether the level file set it
to something other than random. If so, it uses that value.

I debated whether this should allow a level designer to make a monster
of a gender that conflicts with their species, such as a male nymph, but
erred on the side of respecting the species. So attempting to specify a
male nymph, etc. will still result in a female one.

3 years agoSome more therecmdmenu
Pasi Kallinen [Fri, 8 Apr 2022 16:45:10 +0000 (19:45 +0300)]
Some more therecmdmenu

If on, therecmdmenu handles clicking anywhere on the map,
not just on or next to hero.  Add throwing items to the menu.

3 years agopull request #714 - dosacrifice() change
PatR [Fri, 8 Apr 2022 16:41:27 +0000 (09:41 -0700)]
pull request #714 - dosacrifice() change

Move some #offer code into a separate routine to eliminate one 'goto'.

Closes #714

3 years agoSeparate function for offering too soon
SHIRAKATA Kentaro [Fri, 25 Mar 2022 17:34:54 +0000 (02:34 +0900)]
Separate function for offering too soon

3 years agoaligned cleric corpse
PatR [Fri, 8 Apr 2022 07:35:13 +0000 (00:35 -0700)]
aligned cleric corpse

I was looking into "The Lord Surtur's corpse" and got side-tracked by
something else:  move a priest hack for avoiding "aligned" in a corpse
description from corpse_xname() to obj_pmname().  The old variation
always picked "priest corpse" over "priestess corpse".  The new one
will use either one of those if the corpse is flagged as such, or use
"cleric corpse" (avoiding "aligned cleric corpse") if it's flagged as
random.

3 years agoAdd chat and offer to herecmdmenu
Pasi Kallinen [Thu, 7 Apr 2022 15:06:31 +0000 (18:06 +0300)]
Add chat and offer to herecmdmenu

3 years agoWhen levitating, hide drink and dip from herecmd_menu
Pasi Kallinen [Thu, 7 Apr 2022 13:44:16 +0000 (16:44 +0300)]
When levitating, hide drink and dip from herecmd_menu

3 years agosome options handling cleanup
PatR [Wed, 6 Apr 2022 19:08:58 +0000 (12:08 -0700)]
some options handling cleanup

Hide 'altkeyhandling' from the 'O' menu for !WIN32 builds.  If
present in run-time config file it will be parsed and then ignored.

Instead of showing "unknown" for the value of the 'hilite_status'
compound option, show "none" if there are no highlighting rules, or
a pointer to other option "status highlight rules" when there are.

Deal with a few function parameters that are used for some
combination of build-time config settings and unused for others.

3 years agowarning fix
PatR [Wed, 6 Apr 2022 19:06:47 +0000 (12:06 -0700)]
warning fix

Remove redundant 'if (K)' from there_cmd_menu().  The !K case doesn't
get there and that test's presence fools the compiler (oldish clang)
into warning that 'npick' might be used uninitialized.

3 years agoImprove therecmdmenu
Pasi Kallinen [Wed, 6 Apr 2022 18:19:36 +0000 (21:19 +0300)]
Improve therecmdmenu

Turning on herecmd_menu and clicking with mouse is now actually
somewhat playable.

3 years agoX11 build fix
PatR [Wed, 6 Apr 2022 18:18:51 +0000 (11:18 -0700)]
X11 build fix

The X11 interface wouldn't build if STATUS_HILITES was disabled.
Failure was due to post-3.6.x changes.

3 years agofixes entry typo
PatR [Wed, 6 Apr 2022 07:41:22 +0000 (00:41 -0700)]
fixes entry typo

3 years ago'O' vs msg_window option
PatR [Tue, 5 Apr 2022 20:35:23 +0000 (13:35 -0700)]
'O' vs msg_window option

Change 'O's sub-menu for selecting new msg_window option setting to
work similar to the one for menustyle:  show a description of what
the values mean with a two-line, two-column menu entry.  Also make
its current value be pre-selected.

msg_window is a bit more complicated than menustyle because only
some interfaces support it and curses only supports two of the four
choices.  It currently has one hard-coded reference to "^P" (in the
tty-specific 'combination' choice).  Changing that is feasible but
seems like more trouble than it'd be worth.

3 years agoFix mouse travel and look
Pasi Kallinen [Tue, 5 Apr 2022 12:02:56 +0000 (15:02 +0300)]
Fix mouse travel and look

Looks like I broke mouse travel and clicklook a while back, and
no-one noticed...

3 years agolife-saved, while helpless
PatR [Mon, 4 Apr 2022 17:20:28 +0000 (10:20 -0700)]
life-saved, while helpless

Implement the suggestion by entrez to avoid "while helpless" in the
reason for the second death if hero gets killed, life-saved, and
killed again at the same time.  Life saving sets 'multi' to -1 which
prevents the hero from moving again until next turn and is intended
to make the sequencing of "you survived that attempt on your life"
work if you're being interrupted during some multi-turn activity.

It used to behave differently when the first death occurred while
engaged in some voluntary multi-turn activity.  I've removed that
because I couldn't figure out why; it might need to be put back.

3 years agoclear a warning: variable set but not used
nhmall [Mon, 4 Apr 2022 14:35:43 +0000 (10:35 -0400)]
clear a warning: variable set but not used

makedefs.c:2125:12: warning: variable 'sum' set but not used
[-Wunused-but-set-variable]
    int i, sum = 0;
           ^
    1 warning generated.

3 years agoGive a message when stinking cloud is created on top of hero
Pasi Kallinen [Sun, 3 Apr 2022 17:43:04 +0000 (20:43 +0300)]
Give a message when stinking cloud is created on top of hero

3 years agoAsk to kick a locked door open, if hero has no unlocking tool
Pasi Kallinen [Sun, 3 Apr 2022 10:58:50 +0000 (13:58 +0300)]
Ask to kick a locked door open, if hero has no unlocking tool

3 years agomenuitem_invert_test() comment clarification
PatR [Sun, 3 Apr 2022 08:32:59 +0000 (01:32 -0700)]
menuitem_invert_test() comment clarification

3 years agoReverse the unique requirement
Pasi Kallinen [Sun, 3 Apr 2022 05:55:09 +0000 (08:55 +0300)]
Reverse the unique requirement

3 years agoWindows build test with Visual Studio 2022 17.1.3
nhmall [Sat, 2 Apr 2022 17:45:04 +0000 (13:45 -0400)]
Windows build test with Visual Studio 2022 17.1.3

3 years agoDon't pacify unique monsters when untrapping them from web
Pasi Kallinen [Sat, 2 Apr 2022 16:38:50 +0000 (19:38 +0300)]
Don't pacify unique monsters when untrapping them from web

3 years agoFix stuck travel for good
Pasi Kallinen [Sat, 2 Apr 2022 15:16:19 +0000 (18:16 +0300)]
Fix stuck travel for good

My fixes to the travel stuck oscillation did not fix all of them,
and I've even seen a 3-step loop - which my fixes cannot detect.
I guess there could be arbitrary-sized loops too.

To definitely fix this, keep track of all the map locations travel
has moved the hero through, and if it tries to go on a location already
used, stop travel and give the unsure -message.

3 years agotty logic error using menuitem_invert_test()
PatR [Sat, 2 Apr 2022 08:00:09 +0000 (01:00 -0700)]
tty logic error using menuitem_invert_test()

menuitem_invert_test() is intended for invert-all/invert-page/
select-all/select-page but was being called for group accelerators.
In the #wizidentify menu, the 'all' choice specifies ^I as a group
accelerator but that stopped working on tty when it recently became
flagged as skip-invert.

3 years agowishing for artifacts
PatR [Sat, 2 Apr 2022 07:28:48 +0000 (00:28 -0700)]
wishing for artifacts

Use 'fuzzymatch(,," -",)' when checking whether the name specified
in a player's wish text matches an artifact name so that extra or
omitted spaces and dashes are ignored.  Wishing for "firebrand" will
yield "Fire Brand" and "demon bane" will yield "Demonbane".

3 years agomake zip file contents pathless for msdos pkg
nhmall [Fri, 1 Apr 2022 20:11:30 +0000 (16:11 -0400)]
make zip file contents pathless for msdos pkg

3 years agowishing for flint
PatR [Fri, 1 Apr 2022 17:53:19 +0000 (10:53 -0700)]
wishing for flint

Allow wishes for quantity up to 20 to be granted when asking for
flint.  Like rocks, flints are mainly useful as sling ammo.

Also, remove the hardcoded assumption that globs weigh 20 when wish
handling computes glob weight based on user-specified count and/or
relative size.

3 years agoglob rot - replace misspelled dissipates with \
PatR [Fri, 1 Apr 2022 17:47:25 +0000 (10:47 -0700)]
glob rot - replace misspelled dissipates with \

dissolves

"The glob of <type> dissippates completely" was misspelled.  Instead
of just fixing the spelling, switch to a different term since
dissipate is also being used for gas clouds and globs aren't gaseous.

3 years agopull request #718 - fix 'petrified' typo
PatR [Fri, 1 Apr 2022 17:03:37 +0000 (10:03 -0700)]
pull request #718 - fix 'petrified' typo

Pull request from vultur-cadens to fix a recently introduced typo.

Closes #718

3 years agofix "pertrified" typo
vultur-cadens [Fri, 1 Apr 2022 05:36:44 +0000 (22:36 -0700)]
fix "pertrified" typo

3 years agosengr_at() schizophrenia
PatR [Fri, 1 Apr 2022 12:22:20 +0000 (05:22 -0700)]
sengr_at() schizophrenia

sengr_at() is used as a boolean, declared as int, and returns FALSE
if there is no engraving present.  Change the declaration to boolean.

Also, using fuzzymatch() without any list of ignorable characters
just to get case-insensitve matching didn't make sense so switch to
strcmpi().

3 years agogit issue #717 - avoid putting monsters on scare \
PatR [Fri, 1 Apr 2022 12:09:58 +0000 (05:09 -0700)]
git issue #717 - avoid putting monsters on scare \

monster and Elbereth unless there's no other choice.

Suggested by NetSysFire, don't create new monsters on top of scrolls
of scare monster.  Not mentioned in the suggestion:  unless they are
a type of monster that isn't affected by such scrolls.  This extends
it to teleport destination too.

Avoid placing a monster on a scroll of scare monster or on engraved
Elbereth if there are other locations available.  Only performed for
callers of goodpos() who explicitly request it, which at the moment
are makemon(), rloc(), and enexto().

Also, propagate 'mmflags_nht' to a bunch of places that were left
using long or unsigned for makemon() and goodpos() flags.  I didn't
attempt to be systematic about that though.

Implements #717

3 years agoFix medusa levels
Pasi Kallinen [Fri, 1 Apr 2022 05:50:22 +0000 (08:50 +0300)]
Fix medusa levels

My recent commit broke medusa-3 and medusa-4, so fix those.

Make des.stair and des.ladder also accept hash-coordinate:
  des.stair("up", {8, 10});

3 years agoUse correct findtravelpath param value
Pasi Kallinen [Thu, 31 Mar 2022 14:50:00 +0000 (17:50 +0300)]
Use correct findtravelpath param value

3 years agogithub issue #715 - losing stoning resistance \
PatR [Thu, 31 Mar 2022 11:48:26 +0000 (04:48 -0700)]
github issue #715 - losing stoning resistance \

while wielding a cockatrice corpse without gloves

Reported by vultur-cadens:  if safely wielding a cockatrice corpse
without gloves due to temporary stoning resistance or wearing yellow
dragon scales/mail, having the resistance be lost to timeout or to
taking off the dragon armor should have turned the hero to stone but
didn't.

Extend the handling for taking off gloves to cover these other two
cases too.  The feedback for these deaths is usually too verbose to
fit on the tombstone but does show up in logfile.

Fixes #715

3 years agogithub issue #716 - teleporting onto pits
PatR [Wed, 30 Mar 2022 21:41:53 +0000 (14:41 -0700)]
github issue #716 - teleporting onto pits

Implement the suggestion by NetSysFire that a levitating of flying
hero won't treat pits and holes as off limits when testing potential
destinations during teleport.

Closes #716

3 years agofix #K3564 - obj sanity failure: N globs for N>1
PatR [Wed, 30 Mar 2022 21:11:29 +0000 (14:11 -0700)]
fix #K3564 - obj sanity failure: N globs for N>1

Using #name and picking an item on the floor to be assigned a type
name allowed any of the four types of globs to be named.  After
that, wishing for those by the assigned name bypassed the code that
forced the quantity to stay at 1.  Asking for "3 foo" could then
produce "3 small globs of gray ooze" which fails obj_sanity() and
issues an impossible warning (which the fuzzer escalates to panic).

The "getobj refactor" patch changed the return value of call_ok().
When it gets used to check whether an object on the floor could have
a type name assigned (rather than as a getobj() callback), the test
that should have rejected the naming attempt accepted it instead.

Update the wishing code to handle globs differently:  you can still
specify the relative size via small, medium, large, or very large,
but now you can specify a count either instead or in addition.  A
count of more than 1 is used to multiply the created glob's weight,
although it's less likely to be honored as-is when the size is bigger
than small.  Quantity is always forced to 1, at a different place in
readobjnam() than previously.

3 years agocouple of Guidebook bits: autopickup, tile_file
PatR [Tue, 29 Mar 2022 18:24:45 +0000 (11:24 -0700)]
couple of Guidebook bits: autopickup, tile_file

The change in the long-standing default for 'autopickup' warrants
mention in the Guidebook.  Also, the X11 interface can switch to
alternate tiles but doesn't use the 'tile_file' option to do so.

In Guidebook.mn, the list of options pads ones shorter than 8
characters with trailing spaces, necessitating quotes.  A few longer
ones had such quotes and even trailing spaces.  Take those away.