]> granicus.if.org Git - nethack/log
nethack
3 years agoENHANCED_SYMBOLS
nhmall [Sat, 7 May 2022 14:25:13 +0000 (10:25 -0400)]
ENHANCED_SYMBOLS

A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c

3 years agofix comment (copy/paste victim)
PatR [Sat, 7 May 2022 07:38:44 +0000 (00:38 -0700)]
fix comment (copy/paste victim)

3 years agofix github issue #752 - characteristics init
PatR [Sat, 7 May 2022 07:25:03 +0000 (00:25 -0700)]
fix github issue #752 - characteristics init

Issue #752 by vultur-cadens:  initialization of characteristics had
off by one errors when reducing over-allocation and when increasing
under-allocation, biasing Str over Cha.

This simplifies the code very slightly but it still seems somewhat
confusing to me.

A couple of reformatting bits are included.

Closes #752

3 years agoautounlock parsing confusion
PatR [Sat, 7 May 2022 01:41:54 +0000 (18:41 -0700)]
autounlock parsing confusion

For char *next; don't compare (next = index(...)) != '\0'.
'\0' has value 0 and 0 used in a pointer context is a null pointer.
So the code worked as intended even though it wasn't written as
what was intended.  Fix: take off the char decoration.

3 years agobusy hero ignoring monster threat
PatR [Sat, 7 May 2022 01:30:06 +0000 (18:30 -0700)]
busy hero ignoring monster threat

Fix the problem reported by entrez of a zombie corpse reviving and
crawling out of the ground while the hero was busy doing something
(searching, digging, &c) and having the hero fail to react and just
keep doing whatever the thing was because the zombie was already
inside the range where a monster changes from no-threat to threat.

Done in the monster creation routine so any new monster (including
one revived from a corpse) that is visible,&c will cause the hero's
action to be interrupted.  Teleport arrival probably needs this too.

Only interrupts an occupation, not other voluntary multi-turn
actitivy such as running or traveling.  That would be trivial to
change ['if (g.occupation...' to 'if ((g.occupation || multi > 0)...']
but I'm not sure whether it ought to be extended to that.

3 years agoautounlock:untrap
PatR [Fri, 6 May 2022 21:44:57 +0000 (14:44 -0700)]
autounlock:untrap

Implement 'untrap' as an 'autounlock' action.  Quite a bit more work
than anticipated.  The new documentation is rather clumsy; too many
if-this and if-not-that clauses have intruded.

I'll be astonished if all the return values are correct....

[A couple of places were checking for (rx != 0 && ry != 0) to decide
whether they were performating an autounlock action at <rx,ry> but
that erroneously excludes the top line of the map if the current
level extends that far.  Just check rx for zero/non-zero.]

3 years agominor trapped container changes
PatR [Fri, 6 May 2022 20:27:11 +0000 (13:27 -0700)]
minor trapped container changes

When probing a trapped container, report that it is trapped.
Done with a one-line message in the zap code and also in the title
of the contents display if it isn't empty.

For wizard mode wishing, if both "trapped" and "broken" are specified,
produce an untrapped container with a broken lock.

Also for wizard mode wishing, ignore "trapped" if player wishes for
"trapped secret door".

3 years agoautounlock overhaul
PatR [Thu, 5 May 2022 02:13:28 +0000 (19:13 -0700)]
autounlock overhaul

This gives the player more control over what autounlock does.  It is
now a compound option rather than a boolean, and takes values of
  autounlock:none
  !autounlock or noautounlock (shortcuts for none)
  autounlock:untrap + apply-key + kick + force (spaces are optional
    or can be used instead of plus-signs, but can't mix "foo bar+quux")
  autounlock (without a value, shortcut for autounlock:apply-key).
Default is autounlock:apply-key.

Untrap isn't implemented (feel free to jump in) so is suppressed from
the 'O' command's new sub-menu for autounlock.  It's parsed and
accepted from .nethackrc but won't accomplish anything.

[Just musing: it should be feasible to kick in direction '.' to break
open a container or #force to an adjacent spot to break open a door.
If that was done, autounlock:kick+force (or more likely autounlock:
apply-key+kick+force when lacking a key) would resort to force if hero
couldn't kick due to wounded legs or riding.

This changes struct flags so increments EDITLEVEL again.

This includes pull requests #750 from entrez and #751 from FIQ but was
entered from scratch rather than using use their commits.

Closes #750
Closes #751

3 years agoskipinvert handling in tty menus
PatR [Wed, 4 May 2022 21:19:16 +0000 (14:19 -0700)]
skipinvert handling in tty menus

Select all and unselect all were passing the wrong third argument to
menuitem_invert_test().  Select page and unselect page had it right.

3 years agounreferenced local variable warning
nhmall [Wed, 4 May 2022 12:48:56 +0000 (08:48 -0400)]
unreferenced local variable warning

3 years agopull request #749 - MSGHANDLER for #if WIN32
PatR [Tue, 3 May 2022 21:43:44 +0000 (14:43 -0700)]
pull request #749 - MSGHANDLER for #if WIN32

github pull request #749 by argrath:  add support for MSGHANDLER for
WIN32 using spawn() rather than the fork()+exec() used on UNIX.

Closes #749

3 years agoupdate condition for displaying on #version
SHIRAKATA Kentaro [Thu, 4 Nov 2021 20:16:28 +0000 (05:16 +0900)]
update condition for displaying on #version

3 years agoadd msghandler support for win32
SHIRAKATA Kentaro [Thu, 4 Nov 2021 20:16:28 +0000 (05:16 +0900)]
add msghandler support for win32

3 years agoFix warnings, add newline before function braces
Pasi Kallinen [Mon, 2 May 2022 09:46:02 +0000 (12:46 +0300)]
Fix warnings, add newline before function braces

3 years agonhlua.c: bugfix - remove the handler after calling lua_pcall()
nhkeni [Mon, 2 May 2022 01:09:59 +0000 (21:09 -0400)]
nhlua.c: bugfix - remove the handler after calling lua_pcall()

3 years agopets and portals
PatR [Sun, 1 May 2022 22:09:17 +0000 (15:09 -0700)]
pets and portals

Extend pull request #737,
commit d6ab241b8c39830de41c61f6fc2df5760d239cb9, to magic portals.
If hero is on or next to a magic portal, have pets behave as if food
they want is being carried, like PR #737 did for hero standing on
stairs.  (To be on one, hero must have come through from the other
side and not moved off the receiving portal yet, or else is in the
endgame but no longer carrying the Amulet.)

3 years agowarning bits on Windows build
nhmall [Sun, 1 May 2022 16:18:45 +0000 (12:18 -0400)]
warning bits on Windows build

src/nhlua.c(1606): warning C4127: conditional expression is constant
src/nhlua.c(2032): warning C4127: conditional expression is constant

3 years agoRemove extra full stop from SOUND error
Pasi Kallinen [Sat, 30 Apr 2022 13:53:47 +0000 (16:53 +0300)]
Remove extra full stop from SOUND error

3 years agopull request #728 - high-altar desecration
PatR [Sat, 30 Apr 2022 06:22:45 +0000 (23:22 -0700)]
pull request #728 - high-altar desecration

Pull request from argrath:  move code to handle the desecration of a
high-altar out of dosacrifice() into a separate routine.

Closes #728

3 years agoSeparate some codes for desecratintg high altar
SHIRAKATA Kentaro [Sat, 26 Mar 2022 19:15:23 +0000 (04:15 +0900)]
Separate some codes for desecratintg high altar

... and remove one goto.

3 years agopull request #747 - tty_add_menu() defensiveness
PatR [Sat, 30 Apr 2022 06:10:55 +0000 (23:10 -0700)]
pull request #747 - tty_add_menu() defensiveness

Pull request by argrath:  remove an unneeded test for Null when
setting up a new menu entry for tty.

Closes #747

3 years agoremove redundant condition on tty_add_menu()
SHIRAKATA Kentaro [Tue, 8 Feb 2022 18:44:04 +0000 (03:44 +0900)]
remove redundant condition on tty_add_menu()

`newstr` is assigned to `str` or `buf`.
`buf` is an address of an array, and `str` is guarded,
so both are non-NULL.

3 years agoavoid new "where are we?" panic
PatR [Sat, 30 Apr 2022 06:00:51 +0000 (23:00 -0700)]
avoid new "where are we?" panic

savelev() gets run to clean up memory even if the player quits before
level 1 is created, and a change made yesterday panicked if it couldn't
figure out what level the hero is on.  Caught by entrez, again....

If not actually writing a level's file, don't panic if both u.uz and
g.uz_save are 0.  Having one of those be non-zero is only essential
when the level being processed is the Plane of Water or Plane of Air.

3 years agofix compatability checking for development
PatR [Sat, 30 Apr 2022 05:37:13 +0000 (22:37 -0700)]
fix compatability checking for development

It is astounding that after all this time no one noticed that
incrementing EDITLEVEL wasn't doing the job it's intended to do.
Diagnosed by entrez:  since VERSION_COMPATIBILITY was defined as
3.7.0-0 and up, increasing the fourth component wasn't resulting in
old 3.7.0-x files being rejected.

This increments EDITLEVEL yet again, because my testing after
commenting out VERSION_COMPATIBILITY still wasn't rejecting older
files.  Proably because the oldest I had available already had the
verison info with the preceding EDITLEVEL so weren't actually out
of date yet.

Once I had old files be rejected, I discovered that the rejection
message was invisible (for tty on OSX).  The message line showed
spaces, matching the length of the intended message, followed by
--More--.  This fixes that too.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Sat, 30 Apr 2022 01:11:10 +0000 (21:11 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agocommand result handling
PatR [Sat, 30 Apr 2022 00:50:26 +0000 (17:50 -0700)]
command result handling

It's possible to get a strange command result of ECMD_CANCEL+ECMD_TIME.
If/when that happens don't just treat it as cancel, make sure that time
elapses.

If an invalid command is provided, clear the do-again queue so that ^A
won't attempt to try the same invalid command again.

3 years agoLua sandbox
nhkeni [Fri, 29 Apr 2022 23:46:33 +0000 (19:46 -0400)]
Lua sandbox

    This is enough to prevent abuse by denying access to functions and
    denial of service (RAM and instruction step limits), but not enough
    to allow restricted use of things that require finer control (e.g.
    filesystem access).

    If something goes wrong, the whole thing can be turned off, for
    now, in config.h (see NHL_SANDBOX).

    None of the current functionality requires changes to build systems;
    some of the possible future functionality may require some #defines
    - TBD.  There is lots of dead code (#ifdef notyet) for bits of that
    additional functionality; we can rip it out if we don't want those
    additions or we can complete (parts of) it depending on our needs.

    All current uses of Lua are connected to sandboxes and guarded with
    nhl_pcall (sandbox and lua_pcall wrapper); options and limits can
    be set at the callsites in the passed nhl_sandbox_info.  Some of
    the error handling may be wrong - panic() vs.  impossible() vs
    silence.

    Memory and instruction step limits should be tuned prior to release;
    there's no point tuning them now.

3 years agobubble/cloud save/restore overhaul
PatR [Fri, 29 Apr 2022 19:44:26 +0000 (12:44 -0700)]
bubble/cloud save/restore overhaul

The air bubbles on the Plane of Water and the clouds on the Plane of
Air were being saved and restored as part of the current level's state
(which is the 'u' struct and invent and such) rather than with the
current level itself.  That was ok for normal play, but for wizard
mode's ^V allowing you to return to a previously visited endgame level
after moving to a different one it meant a new set of bubbles for
Water and new set of clouds for Air.  Even that was ok since it only
applied to wizard mode, but using #wizmakemap to recreate Water or Air
while you were on it added a new set of bubbles or clouds to the
existing ones.  If repeated, eventually there wouldn't be much water
or air left.

Instead of just adding a hack to #wizmakemap, change save/restore to
keep the bubbles/clouds with the level rather than with the state.
That wasn't trivial and now I know why the old odd arrangement was
chosen.  Saving hides u.uz by zeroing it out for levels that the hero
isn't on and it is zero during restore so simple checks for whether a
given level is water or air won't work.

This also adds another non-file/non-debugpline() use of DEBUGFILES:
 DEBUGFILES=seethru nethack -D
will make water and clouds be transparent instead of opaque.  It also
makes fumaroles and other light-blocking gas clouds be transparent
which wasn't really intended, but avoiding it would be extra work that
doesn't accomplish much.

Increments EDITLEVEL for the third time this week....

3 years agoforcefight against edge of map
PatR [Thu, 28 Apr 2022 09:21:46 +0000 (02:21 -0700)]
forcefight against edge of map

Noticed when testing the forcefight against obscured furniture fix:
if you attempted forcefight against the edge of the map, you got
feedback about having already moved as far in <direction> as possible
rather than about forcefight failing to attack anything.  Have the
can't move out bounds test check for forcefight before deciding to
give to its normal feedback.

3 years agofixes entry for pull request #746 - force-fight \
PatR [Thu, 28 Apr 2022 08:33:31 +0000 (01:33 -0700)]
fixes entry for pull request #746 - force-fight \

against "unknown obstacle"

Pull request #746 by entrez:  give better feedback when 'F' prefix
is used toward furniture covered by objects and towards solid rock
terrain on arboreal levels.

Fixes #746

3 years agoFix: force-fight 'unknown obstacle' descriptions
Michael Meyer [Wed, 27 Apr 2022 01:58:51 +0000 (21:58 -0400)]
Fix: force-fight 'unknown obstacle' descriptions

This is intended to address a couple quirks with force-fighting an
unoccupied spot that I noticed:

 * Now that furniture is considered 'solid', an object is much more
   likely to be sitting on the square, obscuring the terrain glyph.  As
   a result, the current glyph is no longer sufficient to accurately
   describe the contents of the spot -- e.g., an altar with a corpse on
   top of it was being described as "an unknown obstacle", even when the
   hero knew exactly what furniture was there.

 * When blind and attacking an unexplored 'solid' square, the attacked
   position would always be described as 'the stone', even something
   like a fountain or sink which didn't seem likely to be confused with
   a stone wall.

 * The feedback for attacking stone was previously changed from 'solid
   rock' to 'stone' in order to be consistent with the feedback for
   attacking an unseen wall, but they still weren't quite the same
   ("stone" vs "the stone").

 * The 'stone' feedback for all STONE/SCORR spots was incorrect on
   levels flagged as arboreal, where stone is rendered and described as
   trees.

This relies on back_to_glyph for positions where the hero is aware of
the terrain and certain other spots (like stone, walls, etc) for which
back_to_glyph produces good results even if they're unseen, and falls
back to the generic "unknown terrain" in other cases.

Pretty long commit message for such a small commit, but oh well...

3 years agoshow trapped doors,chests as themselves \
PatR [Thu, 28 Apr 2022 00:16:23 +0000 (17:16 -0700)]
show trapped doors,chests as themselves \

instead of as fake bear traps

Use the new traps and their tiles when confused gold detection finds
trapped doors and trapped chests.  (Large boxes can be trapped too;
they use the trapped chest trap and corresponding tile rather than
have their own.)

Usually these pseudo-traps go away when as soon as they are within
line of sight.  (While testing, I noticed that seeing a trapped door
from outside its room rather than inside didn't behave that way.
The door was created by wizard mode wishing; I don't know whether
that was a factor.)

I also discovered that secret doors weren't being handled correctly.
They can't be trapped because of their use of both the doormask and
wall_info overlays of levl[][].flags, but I had a secret door be
falsely displayed as a trap.  This fixes that.

We should have obj->tknown and rm->D_TRAPKNOWN so that the hero won't
forget about these traps after declining to attempt to untrap them.
But that's more work than I care to tackle.

3 years agorevisit Qt6 macOS QSoundEffect
nhmall [Wed, 27 Apr 2022 23:06:06 +0000 (19:06 -0400)]
revisit Qt6 macOS QSoundEffect

- After reverting previous related commit, add the QtMultimedia folder to
the include search path as suggested by PatR, and leave qt_bind.cpp alone

3 years agoRevert "Qt6 QSoundEffect on macOS"
nhmall [Wed, 27 Apr 2022 23:00:18 +0000 (19:00 -0400)]
Revert "Qt6 QSoundEffect on macOS"

This reverts commit f6149904c300bf1658d1c04a7d47a86fad77a1de.

3 years agoextra traps followup
PatR [Wed, 27 Apr 2022 22:43:18 +0000 (15:43 -0700)]
extra traps followup

"add glyphs+tiles for door+chest traps",
commit d1217b9f2565a5db7572c7e80c36372115465a1d,
missed a couple of S_vibrating_square references, resulting in
screwed up rendering of zaps and explosions.

3 years agoadd glyphs+tiles for door+chest traps
PatR [Wed, 27 Apr 2022 18:22:12 +0000 (11:22 -0700)]
add glyphs+tiles for door+chest traps

When trap detection finds trapped doors and trapped chests, it shows
those as bear traps.  When the hero comes within view, they revert to
normal and the detected trap is forgotten.  This doesn't change that,
it is just groundwork to be able to show them distinctly.  Like the
TT_BEARTRAP patch, it increments EDITLEVEL so this seemed like a good
time to put the groudwork in place.

There shouldn't be any visible changes even though internal glyph and
tile values have been renumbered after inserting two new entries.
Adding traps after S_vibrating_square was quite a hassle and suffered
though a couple of off-by-one errors that weren't trivial to find and
fix.

3 years agou.utraptype, TT_BEARTRAP
PatR [Wed, 27 Apr 2022 18:04:12 +0000 (11:04 -0700)]
u.utraptype, TT_BEARTRAP

Add 'FIXME' fix by entrez to change TT_BEARTRAP to non-zero.

Increments EDITLEVEL, invalidating existing save and bones files.

3 years agoQt6 QSoundEffect on macOS
nhmall [Wed, 27 Apr 2022 17:56:01 +0000 (13:56 -0400)]
Qt6 QSoundEffect on macOS

3 years agoconsolidate two fixes entries for QSoundEffect
nhmall [Wed, 27 Apr 2022 12:40:02 +0000 (08:40 -0400)]
consolidate two fixes entries for QSoundEffect

3 years agoQt comment update
nhmall [Wed, 27 Apr 2022 11:52:10 +0000 (07:52 -0400)]
Qt comment update

3 years agoadd a fixes note on change from QSound to QSoundEffect
nhmall [Wed, 27 Apr 2022 11:45:43 +0000 (07:45 -0400)]
add a fixes note on change from QSound to QSoundEffect

3 years agoQSoundEffect supported in Qt6 but needs conditional code rework
nhmall [Wed, 27 Apr 2022 11:40:40 +0000 (07:40 -0400)]
QSoundEffect supported in Qt6 but needs conditional code rework

3 years agofix Qt6 broken build
nhmall [Wed, 27 Apr 2022 11:35:31 +0000 (07:35 -0400)]
fix Qt6 broken build

3 years agoWhen setting user sounds, allow also setting a MSGTYPE
Pasi Kallinen [Wed, 27 Apr 2022 10:31:28 +0000 (13:31 +0300)]
When setting user sounds, allow also setting a MSGTYPE

The SOUND lines now have an optional msgtype parameter:

   SOUND=MESG hide "^You miss the " "swing.wav" 75

Fixes #571

3 years agoQt: To play user sounds with volume, replace QSound with QSoundEffect
Pasi Kallinen [Wed, 27 Apr 2022 09:40:53 +0000 (12:40 +0300)]
Qt: To play user sounds with volume, replace QSound with QSoundEffect

3 years agoSplit trap statue creation into separate function
Pasi Kallinen [Tue, 26 Apr 2022 15:09:36 +0000 (18:09 +0300)]
Split trap statue creation into separate function

3 years agoThis is cron-daily v1-Feb-22-2022. 000files updated: Files
nhw_cron [Mon, 25 Apr 2022 19:24:08 +0000 (15:24 -0400)]
This is cron-daily v1-Feb-22-2022.  000files updated: Files

3 years agoSplit trap note choosing into separate function
Pasi Kallinen [Tue, 26 Apr 2022 11:00:09 +0000 (14:00 +0300)]
Split trap note choosing into separate function

3 years agofix github issue #745 - two-weapon paralysis
PatR [Tue, 26 Apr 2022 09:02:31 +0000 (02:02 -0700)]
fix github issue #745 - two-weapon paralysis

Issue #745 by k2:  when using two-weapon combat, the second attack
would still take place even if the first attack caused the hero to
become paralyzed (hitting a floating eye or g.cube).

Cleaver's up-to-three attacks had the same problem but did stop if
the hero underwent life-saving after some fatally damaging counter-
attack.  Two-weapons didn't.  Make them both stop early if either
paralysis or life-save occurs.

Multiple attacking monster against monster and against poly'd hero
already deal with paralysis; life-saving doesn't apply.

Fixes #745

3 years agoUse get_mleash to find the leash attached to monster
Pasi Kallinen [Tue, 26 Apr 2022 05:46:55 +0000 (08:46 +0300)]
Use get_mleash to find the leash attached to monster

3 years agorename sys/windows/Makefile.msc
nhmall [Mon, 25 Apr 2022 19:16:41 +0000 (15:16 -0400)]
rename sys/windows/Makefile.msc

rename sys/windows/Makefile.msc to sys/windows/Makefile.nmake

3 years agoUnify probing an object chain
Pasi Kallinen [Mon, 25 Apr 2022 15:11:32 +0000 (18:11 +0300)]
Unify probing an object chain

3 years agocompiler warning
nhmall [Mon, 25 Apr 2022 13:45:10 +0000 (09:45 -0400)]
compiler warning

src/do_wear.c(2884): warning C4389: '!=': signed/unsigned mismatch

3 years agotested Windows command line build with latest VS
nhmall [Mon, 25 Apr 2022 13:36:33 +0000 (09:36 -0400)]
tested Windows command line build with latest VS

- Microsoft Visual Studio 2017 Community Edition v 15.9.47
- Microsoft Visual Studio 2019 Community Edition v 16.11.13
- Microsoft Visual Studio 2022 Community Edition v 17.1.5

3 years agoCouple more monster iterator uses
Pasi Kallinen [Mon, 25 Apr 2022 09:53:04 +0000 (12:53 +0300)]
Couple more monster iterator uses

3 years ago"empty handed" vs "bare handed"
PatR [Mon, 25 Apr 2022 08:31:34 +0000 (01:31 -0700)]
"empty handed" vs "bare handed"

When not wielding anything, ^X reports "you are empty handed" if
wearing gloves or "you are bare handed" if no gloves.  The ')',
'w-', and 'A)' commands were using "empty handed" unconditionally.
Make them be consisitent with ^X.

After this, body part HANDED is no longer used anywhere except in
body_part().

3 years agofix Rider revival without corpse removal
PatR [Sun, 24 Apr 2022 22:20:45 +0000 (15:20 -0700)]
fix Rider revival without corpse removal

Reported directly to devteam:  when a Rider revived, its corpse
didn't get used up.

The change to have delobj() never destroy Rider corpses, like it
won't destroy the Amulet or invocation items, didn't take into
account that they should be destroyed when Riders revive from them.
Add delobj_core() to be able to do that without changing existing
delobj() usage.

I'm surprised hardfought players haven't been all over this one.

3 years agofix mon_leaving_level
PatR [Sun, 24 Apr 2022 21:44:40 +0000 (14:44 -0700)]
fix mon_leaving_level

Reported directly to devteam:  changing levels while riding gave an
impossible warning, "no monster to remove".

mon_leaving_level() was trying to take hero's steed off the map but
that isn't on the map in the first place.  Only noticable if built
with EXTRA_SANITY_CHECKS enabled.  Normally remove_monster(x,y) just
sets level.monsters[x,y] to Null but with extra checks enabled it
first checks whether that is already Null.

3 years agomore shop wall repair
PatR [Sun, 24 Apr 2022 21:22:05 +0000 (14:22 -0700)]
more shop wall repair

Commit 593c3532fcecd7cabd164ff49a64d414761ad800 took the 'catchup'
argument away from repair_damage() and calculated it in the routine.
Commit 699a25c00b2534383b4ee947b74497203b8c539d put the argument
back but neglected to remove calculating and assigning it, making
the passed value be ignored.  Take that away, finishing 699a25c00b.

That affected shop repair messages but wasn't enough to prevent a
shop wall repair display glitch.  This seems to make things work
properly but is little iffy.

3 years agoMonster list iterator
Pasi Kallinen [Sun, 24 Apr 2022 10:03:43 +0000 (13:03 +0300)]
Monster list iterator

Add some basic functions to iterate through the monster list,
ignoring dead monsters. Mainly just to allow splitting up code
into discrete functions.

Not quite happy with the get_iter_mons_xy - should probably have
a pointer to iterator data struct, which gets passed through instead,
but this works for now.

3 years agofollowup to PR #744 (really this time)
PatR [Sun, 24 Apr 2022 08:01:00 +0000 (01:01 -0700)]
followup to PR #744 (really this time)

Like the commit message for #743, the followup to it was misIDed
as #744.  This one is for #744.  There's no need to check a name
against all the "<class> of typename" unless it contains " of ".

3 years agopull request #744 - specifying items in lua files
PatR [Sun, 24 Apr 2022 07:35:53 +0000 (00:35 -0700)]
pull request #744 - specifying items in lua files

Pull request #744 from vultur-cadens:  the object specification
supported by des.object() was ambiguous for items whose name in
objects[] doesn't include the object class name.  For instance ring
and spellbook of protection are just named "protection" (unlike
"cloak of protection" which has its full name).

Fixes #744

The commit message for pull request #743 misidentified it as #744,
so didn't get marked closed properly.  Do that now...

Closes #743

3 years agoAllow specifying object classes in the object name given to des.object()
vultur-cadens [Sat, 23 Apr 2022 23:59:15 +0000 (16:59 -0700)]
Allow specifying object classes in the object name given to des.object()
and actually do so in the lua files.

Before this, it was not possible to specify (for example) "scroll of
teleportation" in des.object() because there is actually no object
defined in objects.h named "scroll of teleportation", so
find_objtype() failed to find it.  Instead, one had to request
"teleportation", but that is ambiguous, and find_objtype() would find
the first defined item with that name instead (ring of teleportation).

In cases of ambiguity, I referred to the des files from 3.6.6 (before
the lua conversion).

3 years agofollowup to PR #744
PatR [Sun, 24 Apr 2022 07:26:50 +0000 (00:26 -0700)]
followup to PR #744

Pull some pointer assignments in wc_set_window_colors() out of
if-else-endif so that it is more obvious that they can't be Null.

3 years agopull request #744 - remove unneeded Null checks
PatR [Sun, 24 Apr 2022 07:15:31 +0000 (00:15 -0700)]
pull request #744 - remove unneeded Null checks

Pull request #744 from argrath.

Closes #744

3 years agoremove unnecessary null-check on wc_set_window_colors()
SHIRAKATA Kentaro [Tue, 8 Feb 2022 19:57:37 +0000 (04:57 +0900)]
remove unnecessary null-check on wc_set_window_colors()

mungspaces() returns its argument itself, so `newop` is assigned to `buf`, and always non-null.
`tfg` and `tbg` is assigned to (some addition of) `newop`, so these are also always non-null.

3 years agofix to #adjust for '!fixinv' config
PatR [Sat, 23 Apr 2022 21:52:36 +0000 (14:52 -0700)]
fix to #adjust for '!fixinv' config

If you have 'fixinv' set to Off and and an inventory of three items,
they'll always be a and b and c.  #adjust had you pick 'from' slot
among [abc] and the prompt for 'to' was supposed to show the letter
you picked plus 'd' for 'move to last'.  But it was only showing
the 'from' letter itself as likely candidate, omitting the last+1
choice.  (Anything after the last letter in use could be picked and
yield the right result, only the list of likely candidate slots in
the prompt wrong.)

Fixed more by trial and error than by understanding why the old code
didn't do what was intended.

3 years agoinventory item-action: add '-' for uswapwep
PatR [Sat, 23 Apr 2022 18:58:52 +0000 (11:58 -0700)]
inventory item-action: add '-' for uswapwep

There's no 'w-' or 'Q-' for alternate weapon, but context-sensitive
inventory is starting from the object rather than the command so can
finesse that.  'A' does allow alternate weapon to be directly unset
(aka reset to bare/gloved hands) but is not friendly to being passed
queued input.

This adds an extra internal command which only handles unset uswapwep,
even though that is something which is awfully specialized to get it's
own command.  Users don't see this command so that shouldn't matter.

3 years agoitem-action 'Q-' for for uquiver
PatR [Sat, 23 Apr 2022 10:03:50 +0000 (03:03 -0700)]
item-action 'Q-' for for uquiver

For context-sensitve inventory, if player picks the item occupying
the quiver slot, offer '-' as a choice.  Like for wielded weapon,
picking that will clear the slot.  Also, don't include the 'Q' for
quivering it choice since it is already quivered.

Unlike nethack4, we don't currently have a way to explicitly clear
uswapwep.  The sequence #swap, #wield '-', #swap won't work if
primary weapon is cursed and isn't safe to use if alternate one is.
It would be simple enough to just directly call setuswapwep(NULL)
and untwoweapon() in the item-action routine instead of queuing up
some command to do it but that feels a bit unclean.  Adding yet
another internal command for it would work too but this one wouldn't
be for variant user-interaction of an existing command.

3 years ago'f'ire revamp
PatR [Sat, 23 Apr 2022 09:12:21 +0000 (02:12 -0700)]
'f'ire revamp

The fire command could claim that time passed when it hadn't (fill
quiver with ammo, which takes no time, then queue commands to switch
to matching launcher, which should also take no time while queueing,
only during subsequent execution).

If quiver is empty or has ammo in it, give wielded thrown-and-return
weapon (aklys) priority over filling quiver or switching to ammo's
launcher.  Don't do that if quiver has non-ammo in it, otherwise
players running Valks who wield Mjollnir with super strength but
want to throw quivered daggers would complain.

When player is being asked what to fill the quiver with, use the
\#quiver command to do that.  Using it honors a count to split a
stack, handles switching uwep or uswapwep to uquiver, and gives
feedback.  This is actually a fairly substantial change.

For 'fireassist', when switching to a launcher that isn't already
uswapwep pick one known to be blessed or uncursed over one having
unknown BUC status.  But use the latter as last resort.

3 years agofix github issue #742 - suit of no digestion
PatR [Fri, 22 Apr 2022 13:11:12 +0000 (06:11 -0700)]
fix github issue #742 - suit of no digestion

Reported by vultur-cadens:  slow digestion from wearing white dragon
scales/mail blocked per-turn hunger and didn't cause any hunger,
unlike ring of slow digestion which blocks per-turn hunger but still
causes some hunger as a worn ring itself.  If no rings or amulet
were worn, wearing the suit prevented the hero from ever burning any
nutrition.

Change to treat wearing the suit to be quite a bit like wearing a
ring, unless hero is also wearing an actual ring of slow digestion
(then the hunger cost of the suit is 'free').

Wearing a ring of slow digestion and another ring consumes two units
of nutrition every 20 turns, no matter what suit.  Wearing white
dragon scales/mail and two non-slow digestion rings now consumes three
units of nutrition every 20 turns.  Using the suit to effectively get
an extra ring finger isn't free.

Fixes #742

3 years agofix github issue #729 - edibility_prompts()
PatR [Thu, 21 Apr 2022 23:40:43 +0000 (16:40 -0700)]
fix github issue #729 - edibility_prompts()

Issue #729 by argrath points out that one of the checks in
edibility_prompts() couldn't work.

For the next-meal effect after reading a blessed scroll of food
detection, the check whether a corpse was tainted but not dangerous
because the hero had sickness resistance could never be evaluated.
An earlier condition would cause the routine to return before
reaching that check.

Move it sooner, even though doing so violates the "order by most
to least dangerous" guideline.  It was either that or eliminate it
altogether.

edibility_prompts() had a lot of repetitive code that has now been
condensed.

Simplify acid blob corpse handling--for all of eating, not just for
edibility_prompts()--by treating that as "never rots" so that the
'rotted' variable always stays 0.  Now checks for that variable
being greater than some threshold don't need to include "and not an
acid blob corpse" as an exception.  A side-effect of this change is
that not only do they never become tainted, they'll no longer yield
the "you feel sick" outcome when they're old but not old enough to
exceed the tainted threshold.

Bug fix:  edibility testing stopped warning about green slimes.
That worked in 3.6.x, but 3.7 changed the 'cadaver' variable to
exclude them so the check for eating a glob of green slime could no
longer be reached.

Fixes #729

3 years agocorpse gender
PatR [Thu, 21 Apr 2022 10:31:32 +0000 (03:31 -0700)]
corpse gender

Reported by entrez.  Don't make 50% of neuter monsters be flagged as
female.  It doesn't matter for live monsters but gets inherited by
their corpses, where female and non-female corpses stack separately.

3 years agoduplicate status highlight rules
PatR [Thu, 21 Apr 2022 09:39:54 +0000 (02:39 -0700)]
duplicate status highlight rules

Noticed earlier when testing the status_hilite_menu_fld() changes:
if you enter a duplicate rule (with different highlighting), it didn't
replace the previous one and the old rule continued to be used.

This still doesn't do replacement, but by adding the new rule at the
end of the list of rules for the specified field instead of inserting
it at the beginning, the new rule gets used.

3 years agoitem-actions for 'I'
PatR [Thu, 21 Apr 2022 06:27:45 +0000 (23:27 -0700)]
item-actions for 'I'

Support context-sensitive inventory item-actions from the class
inventory display ('I' command) as well as from regular inventory.

3 years agowishing fix (obj->dknown)
PatR [Thu, 21 Apr 2022 06:08:29 +0000 (23:08 -0700)]
wishing fix (obj->dknown)

A change made 5 or 6 weeks ago that was meant to enhance tracking of
artifact creation had an unintended side-effect of making every object
obtained via wishing have its dknown flag be set.  That made them
behave differenly from items picked up off the floor, so revert to the
old behavior.

3 years agoredo status_hilite_menu_fld() [pull request #740]
PatR [Thu, 21 Apr 2022 05:22:36 +0000 (22:22 -0700)]
redo status_hilite_menu_fld() [pull request #740]

Pull request #740 by argrath removes some redundant code.  Instead
of adopting that, this rewrites the section of code in question.

The menu involved allows the user to select both "delete hilites"
and "add new hilite" but if both are selected it would only do
deletion.  It also falsely claimed to have done something if delete
was chosen but no highlights were selected to be deleted.  And it
only added one new highlight for the specified field when adding.
This supports both add and delete on the same menu invocation, for
addition it keeps adding until no new highlight is specified, and
has caller do the highlight updating if any changes are made.

Supersedes #740

3 years agoitem-action 'I' - use #adjust to split a stack
PatR [Wed, 20 Apr 2022 20:38:09 +0000 (13:38 -0700)]
item-action 'I' - use #adjust to split a stack

More context-sensitive inventory support.  While examining inventory,
if you pick an item other than gold and it has a quantity of more
than 1, "I - Adjust inventory by splitting this stack" will be one
of the menu choices.

Breaking doorganize() into two parts was much easier than expected,
but the new internal command added to be an alternate for the first
part had more niggling details than anticipated.

Message history only shows the first digit with "Split off how many?"
if the player enters more than that.

3 years agoanother item-action: 'i' to #adjust inventory
PatR [Wed, 20 Apr 2022 07:55:19 +0000 (00:55 -0700)]
another item-action: 'i' to #adjust inventory

Add context-sensitive inventory item-action 'i' to run the #adjust
command.  Groundwork for item-action 'I' to use #adjust to split a
stack is included but non-functional.

Also reorders some of the enums and switch cases to be alphabetical
by their menu selection letter, dip moves from 'd' (which is drop)
to 'a' and offer/sacrifice moves from last to 'O'.

3 years agofixes entry for PR #738 - "the the entrails"
PatR [Wed, 20 Apr 2022 07:12:45 +0000 (00:12 -0700)]
fixes entry for PR #738 - "the the entrails"

Add pull request #738 by entrez.

Fixes #738

3 years agoFix: "in the the purple worm's entrails"
Michael Meyer [Mon, 18 Apr 2022 21:11:15 +0000 (17:11 -0400)]
Fix: "in the the purple worm's entrails"

The message printed if the hero threw gold while swallowed by an animal
used "the <mon_nam>'s entrails", which produced a doubled 'the'.  It
could also use the wrong possessive form, since it doesn't take
advantage of any of the special case handling in s_suffix.  I think the
only way that could ever be a problem with the current cast of engulfers
is if the hero was swallowed by a purple worm while hallucinating, but I
changed it to use s_suffix anyway.

3 years agopull request #739 - redundancy in adj_pit_checks
PatR [Wed, 20 Apr 2022 07:01:35 +0000 (00:01 -0700)]
pull request #739 - redundancy in adj_pit_checks

Add github pull request #739 by argrath.

Closes #739

3 years agoremove redundant condition on adj_pit_checks()
SHIRAKATA Kentaro [Tue, 8 Feb 2022 20:14:26 +0000 (05:14 +0900)]
remove redundant condition on adj_pit_checks()

supporting is never null, as outer if statement checks it.

3 years agopart of pull request #737 - pets approach \
PatR [Wed, 20 Apr 2022 01:21:26 +0000 (18:21 -0700)]
part of pull request #737 - pets approach \

hero when hero is [impatiently waiting...] on stairs

My attempts to cherry-pick this failed, so this was done manually.
It is a reimplementation of
NullCGT:feature/monster-item-use:dc2cef0562542fece1732dd2d4c4f0775308faff

] Pets approach the player if they are standing on the stairs.
]
] One of the most frequent complaints I have seen is that pets refuse
] to follow their owners down the stairs. While this can be resolved by
] waiting, most players, especially new ones, are not willing to spend
] multiple dozens of turns waiting for their pets to approach closely
] enough to follow them. This simple commit makes pets react to a player
] standing on stairs as if the player is holding a tripe ration. Simple,
] non-disruptive, and should solve many headaches.

3 years agodisallow assigning type name to Amulet of Yendor
PatR [Tue, 19 Apr 2022 21:19:48 +0000 (14:19 -0700)]
disallow assigning type name to Amulet of Yendor

Something I noticed when testing the item-action handling for name and
call; applies to the C/#name command too.  You were allowed to call the
real Amulet something and allowed to call fake ones something [else].
If you did that, xname/doname didn't show it but the discoveries list
did, giving away information when the player had access to more than
one unID'd Amulet of Yendor.  Rather than messing about with discovery
handling, make real and fake Amulet be ineligible from being given a
type name.  (They can still be given individual names.)

3 years agocommand queue handling in getobj, yn_function
PatR [Tue, 19 Apr 2022 20:53:40 +0000 (13:53 -0700)]
command queue handling in getobj, yn_function

Mostly attempting to clean up potential error handling but I don't
have any error cases to test with.  Doesn't seem to break anything
when there aren't any errors....

3 years agomon_leaving_level followup
PatR [Tue, 19 Apr 2022 19:30:23 +0000 (12:30 -0700)]
mon_leaving_level followup

3 years agoitem-action refinements for name/call and read
PatR [Tue, 19 Apr 2022 19:26:54 +0000 (12:26 -0700)]
item-action refinements for name/call and read

Switch the verb from "name" to "call" for type-naming.  Format menu
choices for name or call of unique items more carefully.

Read actions got some extra details so move them out of the main
item-action routine to avoid cluttering it up.

Avoid "r - Study the spellbook" for novels.  It's changed for known
Book of the Dead too, but I'm not sure "r - Examine the tome" conveys
"read" sufficiently.  ("Read" and "peruse" seem too mundane for it;
perhaps it should revert to "study" even though the hero isn't
attempting to learn a spell from it.)

Change "r - cast the spell on this scroll" to "r - read this scroll
to activate its magic".  Leave off the last phrase if it's a known
scroll of blank paper or scroll of mail.

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