]> granicus.if.org Git - nethack/log
nethack
2 years agopull request #902 - ^X "Current X" -> just "X"
PatR [Wed, 21 Dec 2022 07:21:32 +0000 (23:21 -0800)]
pull request #902 - ^X "Current X" -> just "X"

Pull request from zomGreg:  for ^X feedback, change "Current Status"
and "Current Attributes" to "Status" and "Attributes", respectively.

Closes #902

2 years agoThe word 'Current' is unnecessary here (and in general).
Greg Moselle [Sun, 16 Oct 2022 18:08:19 +0000 (12:08 -0600)]
The word 'Current' is unnecessary here (and in general).

2 years agosleeping vs deafness
PatR [Tue, 20 Dec 2022 23:23:40 +0000 (15:23 -0800)]
sleeping vs deafness

Another one from entrez: falling asleep tried to make the hero Deaf,
but was adding a negative value to the timeout.  A negative value
of bigger magnitude that the current timeout could produce weird
values when making that be negative and then stuffing it into an
unsigned field.

This applies a fix to sleep-causes-deafness bug but also disables
that, at least for the time being since nobody seemed to notice that
it wasn't working.  The fix might be noticeable so needs testing.

This also adjusts You_hear() so that if Deaf and sleeping are both
active, it will still yield "You dream that your hear ..." instead
having Deaf override that.

2 years agounconscious hero vs Medusa
PatR [Tue, 20 Dec 2022 22:44:19 +0000 (14:44 -0800)]
unconscious hero vs Medusa

Reported directly to devteam by entrez:  a sleeping or unconscious
hero would still meet a monster's gaze attack even though those are
supposed to be eye-to-eye rather than just the monster looking at
you.  Don't meet the gaze when Unaware, despite the fact that the
hero isn't blind and vision remains in operation.

Initially being Unaware also blocked Medusa's gaze being reflected
but I changed things so that that still affects her.  It contradicts
the eye-to-eye aspect but is more consistent with her looking at a
blind hero who has reflection.

2 years agoTypofix
Pasi Kallinen [Mon, 19 Dec 2022 16:20:31 +0000 (18:20 +0200)]
Typofix

2 years agoAdd strangled to safe_wait
Pasi Kallinen [Sun, 18 Dec 2022 10:36:30 +0000 (12:36 +0200)]
Add strangled to safe_wait

... and ignore vomiting from sickness.

2 years agoExpand safe_wait to deadly status afflictions
Pasi Kallinen [Sat, 17 Dec 2022 22:35:41 +0000 (00:35 +0200)]
Expand safe_wait to deadly status afflictions

Searching or waiting with safe_wait on will now consider
sliming, stoning, or deadly illness to be hazardous and prevent
the command.

2 years agoparanoid confirmation prompt
PatR [Fri, 16 Dec 2022 20:21:23 +0000 (12:21 -0800)]
paranoid confirmation prompt

yn() and company show the list of possible responses in square
brackets and the default response in parentheses:
|Do foo? [ynaq] (y)
but paranoid_querty() was using the punctuation chars backwards
|Do foo? (yes) [n]
or
|Do foo? (yes|no)
depending on the level of paranoid.  Change those to be
|Do foo? [yes|n] (n)
(default gets used for <return> but unlike yn(), not for <space>)
and
|Do foo? [yes|no]
(with no default for the latter).

2 years agorole,race,&c options: environment vs config file
PatR [Thu, 15 Dec 2022 23:56:52 +0000 (15:56 -0800)]
role,race,&c options: environment vs config file

Due to the unorthodox values for role, race, gender, and alignment,
specifying a negated value or set of values in NETHACKOPTIONS wasn't
overriding a specific value set in the run-time config file.  The
command line should take priority, then environment, then config file,
lastly builtin defaults.

This could probably use some improvement.  It now treats role:!val
as if there was no val role and the entry was role:random rather than
previous role:none (affects prompting).

[I've just realized that role:!foo in environment will be combined
with role:!bar in config file rather than replacing it.  I'm not sure
how to deal with that.]

2 years agofix issue #949 - dropping welded iron ball
PatR [Thu, 15 Dec 2022 21:48:59 +0000 (13:48 -0800)]
fix issue #949 - dropping welded iron ball

If punished and the attached iron ball was both cursed and wielded,
falling while going down stairs would drop it instead of leaving it
welded to hero's hand. ( Didn't happen for iron ball that wasn't
chained to hero's leg.)

I thought that this was going to be a one or two line fix but ball
and chain stuff is never that simple.

Fixes #949

2 years agospurious warning with visual studio 2017
nhmall [Thu, 15 Dec 2022 13:39:30 +0000 (08:39 -0500)]
spurious warning with visual studio 2017

Don't force on a particular warning in the nmake Makefile if
compiling using the older visual studio 2017.

Resolves #950

2 years agocalling objects
PatR [Wed, 14 Dec 2022 22:07:22 +0000 (14:07 -0800)]
calling objects

An earlier attempted fix was not working as intended.  This
accomplishes what I was trying to do.  I haven't reverted
interesting_to_discover() to static within o_init.c.

2 years agorevise the role, race, gender, align options
PatR [Wed, 14 Dec 2022 21:14:54 +0000 (13:14 -0800)]
revise the role, race, gender, align options

Using role:!wizard to limit which roles would be candidates for
random selection didn't work as I expected.  It required a separate
option setting for role to exclude.  This implements how I thought
it worked:
|OPTIONS=role:!ranger !samurai !wizard
will exclude multiple roles with a space-separated list in a single
option setting.  It also adds support for
|OPTIONS=!role:ranger samurai wizard
to do the same thing.  (OPTIONS=!role:!ranger isn't allowed.)

I thought 'OPTIONS=role:barbarian caveman knight' could be used to
limit random selection to those choices, but that doesn't work and
I haven't attempted to implement it.

This also renames the 'align' option to 'alignment'.  That made the
truncation to 'align' become ambiguous, so it got added back as an
alias for the full name.

Guidebook.tex is lagging; I'm burned out.

2 years agoupdate tested versions of Visual Studio 2022-12-14
nhmall [Wed, 14 Dec 2022 19:33:36 +0000 (14:33 -0500)]
update tested versions of Visual Studio 2022-12-14

2 years agopull request #945 - boulder vs shared shop wall
PatR [Wed, 14 Dec 2022 16:28:31 +0000 (08:28 -0800)]
pull request #945 - boulder vs shared shop wall

Pull request from entrez:  a boulder being sold by one shop could be
pushed into another shop if they had a shared wall with a gap in it.
Treat such as being stolen from the first shop rather than becoming
for-sale in the second shop.

[I haven't done much testing of the stolen_value() changes.]

Fixes #945

2 years agoFix: billing shop boulder pushed thru shared wall
Michael Meyer [Wed, 7 Dec 2022 01:52:13 +0000 (20:52 -0500)]
Fix: billing shop boulder pushed thru shared wall

I realized that the "move the boulder billing to 'used-up items'" part
of 20392a6 didn't properly handle boulder movement from one shop to
another via a gap in a shared wall, becuase it wasn't looking at the
complete in_rooms() array (plus, it only triggered if the new spot
wasn't in any shops at all).  When I tried to fix that, I realized that
stolen_value() was similarly not working reliably when passed a location
shared between two shops, and for the same reason: it was only using the
first character of the in_rooms() array.

I think this patch fixes both those things, but it would be worth
examining the change to stolen_value() carefully, to ensure getting the
roomno via the shkp won't change anything about its normal functioning.
I'm not totally sure about that -- I didn't notice any problems in some
brief tests of typical stolen_value() uses, but it seems like it
probably has some tricky edge cases.

At the very least, passing a boulder fully through a shared wall between
two shops one way, then back the other way, no longer triggers an unpaid
obj sanity check in my testing.

2 years agorefine PR #946 - named armor
PatR [Wed, 14 Dec 2022 15:37:04 +0000 (07:37 -0800)]
refine PR #946 - named armor

Move the new stuff from PR #946 out of xname() into new routine
armor_simple_name().

Noticed while testing:  tweak 'call object type' so that it doesn't
list instances of pre-discovered armor as likely candidates since
assigning a name to such wasn't showing up in the discoveries list.

Add "silver shield" as wishing synonym for "polished silver shield".

2 years agopull request #946 - named armor
PatR [Wed, 14 Dec 2022 13:50:23 +0000 (05:50 -0800)]
pull request #946 - named armor

Pull request from entrez:  use helm_simple_name() instead of
hard-coded "helmet", boots_simple_name() instead of "boots" and so
forth when formatting called but not yet discovered armor-class
objects for inventory, messages, &c.

Closes #946

2 years agoUse foo_simple_name for armor types in xname
Michael Meyer [Fri, 9 Dec 2022 19:41:20 +0000 (14:41 -0500)]
Use foo_simple_name for armor types in xname

This will distinguish between a hat and a helmet, shoes and boots, etc,
so that a "conical hat" doesn't turn into a "helmet called dunce" after
type-naming it, and so on.  Instead, more specific names will be used
for the base type, consistent with the terms used in various messages
(so "a hat called dunce").

Some of these don't seem like necessary distinctions to make, and some
of them probably don't make a difference at all (e.g. gloves vs
gauntlets, since "gauntlets" only shows up once you've IDed the item so
the user-assigned typename isn't visible), but it probably makes sense
to be consistent in using these functions if it's done for any armor
type.

2 years agocast away a new warning
nhmall [Wed, 14 Dec 2022 00:17:00 +0000 (19:17 -0500)]
cast away a new warning

role.c: In function 'plnamesuffix':
role.c:1615:19: warning: operand of '?:' changes signedness from 'int' to 'unsigned int'
due to unsignedness of other operand [-Wsign-compare]
1615 |                 ? (int) (eptr - gp.plname)
                         ^~~~~~~~~~~~~~~~~~~~~~~~

Since Strlen() (actually hacklib's Strlen_ function) returns 'unsigned' for the
second operand of the '?:', the compiler was having to change the signedness
of the first operand '(int) (eptr - gp.plname)' to 'unsigned' and issuing the
warning.

Cast the result of Strlen() to int to make both operands of the '?:' the same
('signed').

2 years agomore interactive role selection
PatR [Tue, 13 Dec 2022 23:59:05 +0000 (15:59 -0800)]
more interactive role selection

This ended up combining several unrelated changes.

Add missing 'fixes' entry for curses-specific item in New Features.

When answering "Shall I pick ... for you? [ynaq]", accept \m as well
as \n and space for choosing the default of 'y', same as normal
ynaq() would.  Also add '*' to '@' as not-shown potential answers;
they force 'random'.

When tty tore down any of the menus, things were reasonable if they
were short enough for corner windows, but tall ones that switch to
full screen weren't fully erased.  The parts of those outside of the
map window stayed behind when the tall menu was closed and cleared.
Mainly affects picking the "~ - reset filtering" choice but also
affected the role menu on 24 line tty screens.  (Didn't affect curses
because it tracks and refreshes its base window when some overlaying
window goes away.)

The role menu used 25 lines so required a second page for the case
of a 24 line screen on tty.  Dealing with that is a bit ugly but it
wasn't an issue when this form of role selection was tty-only (because
the info about choices made so far was displayed on the base window
rather than in an extra menu line back then) so I added a hack for it.
If the role menu will take one more line than the screen height, the
separator between 'random' (below 'Wizard') and 'pick race first' gets
squeezed out.  If the menu needs two more lines (doesn't happen now,
except by changing screen size to 23 lines for testing), a second line
gets squeezed out.  (Not attempted for curses because it wouldn't
help.  'windowborders' and one or two extra separators it adds make
menus taller.  I doubt if many players use curses on 24-line screens
but if they do, they'll be using something new rather than going from
something that used to fit on one page with 3.6.x.)

2 years agotty-style role selection for curses
PatR [Tue, 13 Dec 2022 00:30:27 +0000 (16:30 -0800)]
tty-style role selection for curses

Move the tty role/race/&c selection from wintty.c to role.c and remove
its references to BASE_WINDOW.  Have curses call the same routine now
so that the player has the option to choose role, race, gender, and
alignment in any order and to confirm or override random settings
prior to starting play.  Also if you went through "who are you?" then
final confirmation includes an extra menu choice to rename the hero.

It still has the quirk of sometimes remembering some of the previous
aspects when you re-pick a new value for some aspect which already
been selected.

The menus pop up on top of the copyright screen and that looks a bit
strange.  I don't think core code has any way to erase that base
window without erasing the entire screen so to fix the strangeness
the window ports would need to do that before calling the selection
routine.  I didn't do that because the very first prompt, "Shall I
pick ... for you? [ynaq]" shows up in that window rather than in a
popup over it, and having it be all by itself on an otherwise blank
screen seemed to be even stranger.

X11 and Qt both have more sophisticated selection routines so I
haven't tried to switch either of them to use this.  They both use a
fancy role-selection-specific menu with all the aspects present at
once so this wouldn't fit without more work than I care to tackle.

2 years ago'generic username' checking
PatR [Mon, 12 Dec 2022 22:53:07 +0000 (14:53 -0800)]
'generic username' checking

Don't require the list of generic usernames in sysconf to need to be
ordered to guard against false substring matches.  If the list was
"nethacker nethack" and the tentative character name was "nethack",
it wouldn't be recognized as generic.  The old code forced the list
to be "nethack nethacker" for the matching to work correctly because
it only checked the first matching substring.  Either order works now.

It also failed to recognize a generic name if the player used
|nethack -u nethack-samurai-human-male-lawful
because it checked for generic names before stripping off the role
aspects.  Now that will at least recognize the name as generic and
prompt with "who are you?", but the role/race/&c info gets discarded.

2 years agowindconf.h mingw bit
nhmall [Mon, 12 Dec 2022 20:20:22 +0000 (15:20 -0500)]
windconf.h mingw bit

2 years agofollow-up: make the ifdef logic a bit clearer
nhmall [Mon, 12 Dec 2022 19:37:40 +0000 (14:37 -0500)]
follow-up: make the ifdef logic a bit clearer

2 years agomakedefs temp files issue with mingw
nhmall [Mon, 12 Dec 2022 17:53:51 +0000 (12:53 -0500)]
makedefs temp files issue with mingw

The unlink call wasn't operating the same on a makedefs built
on mingw, and dat/mdXXXX files were being left behind post-build.

Provide an alternative way of doing the temporary files if
MD_USE_TMPFILE_S is defined during the compile of makedefs.c

2 years agofixes update
nhmall [Mon, 12 Dec 2022 02:55:15 +0000 (21:55 -0500)]
fixes update

2 years agoodd Windows lighting in lit rooms (issue #929)
nhmall [Mon, 12 Dec 2022 02:29:42 +0000 (21:29 -0500)]
odd Windows lighting in lit rooms (issue #929)

bkglyph variable gets initialized to GLYPH_UNEXPLORED so ends
up being returned by get_bk_glyph() if something more interesting
wasn't chosen in the switch statement.

The Windows win32 interface will then use the tile mapped to
GLYPH_UNEXPLORED as a background. The tile is 16x16 all black
pixels. That looked very odd.

Treat GLYPH_UNEXPLORED as an out-of-range value.

Closes #929

2 years agomore zapping while hiding-under
PatR [Sun, 11 Dec 2022 02:00:44 +0000 (18:00 -0800)]
more zapping while hiding-under

The previous commit had the up/down test backward.  Also the commit
log text described the old behavior incorrectly:  zapping down while
hiding-under skipped the top item but zapping up hit the whole pile.

Still not adequately tested.

2 years agofix #K3802 - sanity_check: boulder not on top
PatR [Sun, 11 Dec 2022 01:48:55 +0000 (17:48 -0800)]
fix #K3802 - sanity_check: boulder not on top

This should fix the problem of polymorphing or stone-to-fleshing a
pile of multiple boulders and having some underneath ones which get
changed resist and not get changed, producing a pile with one or more
non-boulders above one or more boulders.  If that situation arises,
re-stack the pile so that boulders are moved to the top.

This also revises zapping up or down while hiding under something
(if that is even possible; the types of creatures which can hide
under things can't zap wands or cast spells; maybe there are some
exceptions?).  Zapping up used to hit only the top item, but zapping
down hit the whole stack.  Now up still hits only the top, but down
skips the top and hits the rest.

Caveat: not adquately tested.

2 years agoMerge branch 'unicode-performance' of https://github.com/chasonr/NetHack into NetHack-3.7
nhmall [Sat, 10 Dec 2022 22:15:31 +0000 (17:15 -0500)]
Merge branch 'unicode-performance' of https://github.com/chasonr/NetHack into NetHack-3.7

2 years agoClean up dangling pointers when freeing glyphmap
Ray Chason [Sat, 10 Dec 2022 22:00:28 +0000 (17:00 -0500)]
Clean up dangling pointers when freeing glyphmap

Partially fixes issue #941.

2 years agoRemove some debug code
Ray Chason [Sat, 10 Dec 2022 18:13:28 +0000 (13:13 -0500)]
Remove some debug code

2 years agoRevert adding bsearch to system.h
Ray Chason [Fri, 9 Dec 2022 23:58:19 +0000 (18:58 -0500)]
Revert adding bsearch to system.h

2 years agoReimplement glyph cache as a hash table
Ray Chason [Fri, 9 Dec 2022 23:24:48 +0000 (18:24 -0500)]
Reimplement glyph cache as a hash table

2 years agoReplace Snprintf with faster Strcpy
Ray Chason [Fri, 9 Dec 2022 22:24:21 +0000 (17:24 -0500)]
Replace Snprintf with faster Strcpy

2 years agoDefine a tail pointer for the glyph list
Ray Chason [Tue, 6 Dec 2022 23:46:43 +0000 (18:46 -0500)]
Define a tail pointer for the glyph list

Use the tail pointer to add new glyphs, avoiding the need to traverse
the list.

2 years agoUse pointer assignments to generate glyph names
Ray Chason [Tue, 6 Dec 2022 00:57:46 +0000 (19:57 -0500)]
Use pointer assignments to generate glyph names

2 years agoSkip match_sym for G_ lines
Ray Chason [Tue, 6 Dec 2022 00:56:50 +0000 (19:56 -0500)]
Skip match_sym for G_ lines

2 years agoFix -dumpglyphids on Unix
Ray Chason [Fri, 25 Nov 2022 13:39:38 +0000 (08:39 -0500)]
Fix -dumpglyphids on Unix

The order of the statements needs to be changed, so the -d is not
interpreted as requesting a directory.

2 years agoFill the glyph cache when switching symbol sets
Ray Chason [Fri, 25 Nov 2022 13:39:03 +0000 (08:39 -0500)]
Fill the glyph cache when switching symbol sets

2 years agoSort the glyph cache and search it with bsearch
Ray Chason [Fri, 25 Nov 2022 13:37:55 +0000 (08:37 -0500)]
Sort the glyph cache and search it with bsearch

Also, recognize G_slime_mold and G_piletop_slime_mold when the fruit
has been set.

2 years agosome extern.h reformatting
PatR [Sat, 10 Dec 2022 08:48:38 +0000 (00:48 -0800)]
some extern.h reformatting

Wrap or re-wrap some wide lines.

2 years agoshop sanity check of the day...
PatR [Fri, 9 Dec 2022 20:55:39 +0000 (12:55 -0800)]
shop sanity check of the day...

If a pet picks up a no_charge item in a shop and gets teleported out,
clear that flag.  (It's already being cleared for non-pets as soon as
they pick any item up.)

2 years agoshopping objects, unpaid and no_charge, what else?
PatR [Fri, 9 Dec 2022 12:18:20 +0000 (04:18 -0800)]
shopping objects, unpaid and no_charge, what else?

Revise sanity_check to acknowledge that buried objects might be unpaid
or no_charge.  (For unpaid, drop shop-owned object in a gap in the
shop wall or in the free spot; for no_charge, drop something the shk
doesn't care about, or drop any hero-owned item and decline to sell.
Dig a pit.  Push or drop a boulder to fill the pit.)

Change 'I' to look for unpaid objects on the floor and for buried ones
when deciding when to include 'u' in the list of candidate object
classes and pseudo-classes.

Change 'Iu' to mention buried unpaid objects as well as floor ones.
For both non-invent categories, show a combined count without cost
info.

Have sanity_check of monster inventory test for unpaid and no_charge.

When a monster (including pet) picks up an item that's marked unpaid
(so one dropped on shop boundary, not an ordinary for-sale one), take
it off hero's shopping bill.  If dropped--pet behavior or monster
death--inside the shop, it will become for-sale rather than no_charge
or back on bill.  [Removal from bill is needed to prevent an unpaid
object ending up outside the shop if a monster carries it out, and
current sanity_check complains about an unpaid item in mon->minvent.]

2 years agodoc update
nhmall [Thu, 8 Dec 2022 15:46:36 +0000 (10:46 -0500)]
doc update

2 years agono_charge sanity
PatR [Thu, 8 Dec 2022 10:36:50 +0000 (02:36 -0800)]
no_charge sanity

When a shopkeeper becomes angry, clear the no_charge flag for all
floor objects on the level, even if they happen to be in another
shopkeeper's shop.  Should prevent sanity_check warnings if/when the
angry shk leaves the shop, and once the shk is pacified, items in
the shop that used to be available for free will become for-sale.

2 years agosome shk.c formatting
PatR [Thu, 8 Dec 2022 09:06:09 +0000 (01:06 -0800)]
some shk.c formatting

2 years agofix Makefile rule when building pdcurses library
nhmall [Thu, 8 Dec 2022 02:23:14 +0000 (21:23 -0500)]
fix Makefile rule when building pdcurses library

Also, use Bill Gray's pdcursesmod for now.

2 years agoboulder pushing feedback
PatR [Thu, 8 Dec 2022 00:45:35 +0000 (16:45 -0800)]
boulder pushing feedback

Redo the details about giving or suppressing "with great effort you
push the boulder".  It works the same except that if push a different
boulder than previously, you'll get a new message.  If you do it
while riding, you have the same lack-of-message for successive pushes
instead of getting a message every turn.

Don't exercise strength when pushing a boulder if poly'd into a giant.

2 years agosubmodule update for pdcurses
nhmall [Wed, 7 Dec 2022 22:22:10 +0000 (17:22 -0500)]
submodule update for pdcurses

2 years agorevise man page yet again
PatR [Wed, 7 Dec 2022 20:22:49 +0000 (12:22 -0800)]
revise man page yet again

Rewrite much of the paragraph about the run-time config file.

Remove mention of '-p @' since it doesn't actually work.

Expand 'nethack -s' a bit.

Revise --showpaths.

Shuffle --scores, --version, --showpaths, and --usage into the same
order as usage feedback lists them, primarily scores first and usage
last.

2 years agoFix skipping attacks if hero moved away
Pasi Kallinen [Wed, 7 Dec 2022 19:51:47 +0000 (21:51 +0200)]
Fix skipping attacks if hero moved away

Recent change by me caused a bug where a monster was trying
to attack after hero was moved away by the previous attacks.

2 years agomore continuation alignment after g to g? (.h)
nhmall [Wed, 7 Dec 2022 16:31:11 +0000 (11:31 -0500)]
more continuation alignment after g to g? (.h)

2 years agorealign macro continuation after g to g? expansion
nhmall [Wed, 7 Dec 2022 16:24:17 +0000 (11:24 -0500)]
realign macro continuation after g to g? expansion

2 years agoFollowup to "suicide by wand", remove redundant an()
Patric Mueller [Wed, 7 Dec 2022 14:54:30 +0000 (15:54 +0100)]
Followup to "suicide by wand", remove redundant an()

2 years agoshop wall repair vs unpaid shop goods
PatR [Wed, 7 Dec 2022 10:02:08 +0000 (02:02 -0800)]
shop wall repair vs unpaid shop goods

Take unpaid shop items off the bill if they're on the floor and
wall repair moves them from the shop boundary to all the way inside
the shop.

I don't think it's possible for items to be moved out of the shop
except for the very special case of moving into an adjacent shop
which shares the wall, so clearing no_charge for an item that is no
longer inside a shop is academic.

2 years agotopten.c comments
PatR [Wed, 7 Dec 2022 01:41:44 +0000 (17:41 -0800)]
topten.c comments

2 years agosuicide by wand
PatR [Tue, 6 Dec 2022 19:41:24 +0000 (11:41 -0800)]
suicide by wand

If hero zaps self with a wand and the result is fatal, report the
death as "zapped himself with <a wand of sometype>" rather than just
"zapped himself with a wand".

2 years agounpaid sanity_check: leaving shop via recoil
PatR [Tue, 6 Dec 2022 18:57:14 +0000 (10:57 -0800)]
unpaid sanity_check: leaving shop via recoil

Throwing while levitating or getting hit for knockback effect could
move hero carrying unpaid items out of a shop.  If that happened,
sanity_check complained that unpaid items weren't in a tended shop.

Check for entering and leaving special rooms during recoil same as
gets done for ordinary movement.  Leaving a shop via recoil or
knockback while owing a bill now gets treated as robbery immediately
rather than waiting until hero voluntarily moves to another spot
after recoil has finished.

2 years agopaste error in Makefile.mingw32
nhmall [Tue, 6 Dec 2022 16:00:29 +0000 (11:00 -0500)]
paste error in Makefile.mingw32

2 years agotrap.h formatting
PatR [Tue, 6 Dec 2022 08:49:52 +0000 (00:49 -0800)]
trap.h formatting

I don't know whether we'll ever run the code through clang-format
again, but in case we do, end-of-line comments which span lines
should begin continuation lines with '*', otherwise they get turned
into block comments beginning on the next line.

|code; /* start
|         end */
gets changed to
|code;
|/* start end */

but
|code; /* start
|       * end */
stays as-is.

2 years agousage typo/thinko
PatR [Tue, 6 Dec 2022 07:24:18 +0000 (23:24 -0800)]
usage typo/thinko

2 years agoyet more shop sanity checking
PatR [Tue, 6 Dec 2022 07:05:20 +0000 (23:05 -0800)]
yet more shop sanity checking

Reconcile boulder pushing with no_charge sanity checking.  The hack.c
part comes from entrez.

Pushing a for-sale boulder from inside the shop to the shop's boundary
("free spot", doorway, or gap in wall) adds it to the shop bill even
though it's still on the floor.  Leaving the shop without paying for
it is a robbery.  Also, pushing an unpaid boulder that's on the shop
boundary to any spot that's all the way outside the shop is robbery.

2 years agoclear up a few gcc warnings
nhmall [Tue, 6 Dec 2022 04:19:38 +0000 (23:19 -0500)]
clear up a few gcc warnings

2 years agoissue with mingw resolved; resume mingw build in CI
nhmall [Tue, 6 Dec 2022 00:03:11 +0000 (19:03 -0500)]
issue with mingw resolved; resume mingw build in CI

2 years agodisable mingw build for now
nhmall [Mon, 5 Dec 2022 20:11:26 +0000 (15:11 -0500)]
disable mingw build for now

2 years agoThis is cron-daily v1-May-8-2022. 000files updated: Files
nhw_cron [Mon, 5 Dec 2022 19:24:08 +0000 (14:24 -0500)]
This is cron-daily v1-May-8-2022.  000files updated: Files

2 years agoyet another follow-up after CI report
nhmall [Mon, 5 Dec 2022 19:12:36 +0000 (14:12 -0500)]
yet another follow-up after CI report

2 years agoanother mingw follow-up after CI report
nhmall [Mon, 5 Dec 2022 19:07:33 +0000 (14:07 -0500)]
another mingw follow-up after CI report

2 years agoanother mingw Makefile follow-up
nhmall [Mon, 5 Dec 2022 19:00:22 +0000 (14:00 -0500)]
another mingw Makefile follow-up

2 years agomingw Makefile updates
nhmall [Mon, 5 Dec 2022 18:54:09 +0000 (13:54 -0500)]
mingw Makefile updates

2 years agofix pair of prototype differences between date.c and mdlib.c
nhmall [Mon, 5 Dec 2022 18:39:46 +0000 (13:39 -0500)]
fix pair of prototype differences between date.c and mdlib.c

2 years agoMerge branch 'windows-makefile' into NetHack-3.7
nhmall [Mon, 5 Dec 2022 18:27:25 +0000 (13:27 -0500)]
Merge branch 'windows-makefile' into NetHack-3.7

2 years agorework windows nmake file
nhmall [Mon, 5 Dec 2022 18:21:19 +0000 (13:21 -0500)]
rework windows nmake file

Keep object files separate between gui and tty builds as they
are not the same binary on windows.

The stubs.c file will no longer be necessary.

2 years agono_charge items sanity - shop theft
PatR [Sun, 4 Dec 2022 16:59:22 +0000 (08:59 -0800)]
no_charge items sanity - shop theft

More unpaid/no_charge sanity checking.  If a shop contained any
no_charge objects and was robbed, they would be left no_charge and
trigger sanity check warnings (no_charge in "untended shop") once
the shopkeeper got past any Kops in the way and exited the shop.
Earlier testing didn't wait around long enough for that exit to
happen.

Clear no_charge as soon as the robbery is detected.

2 years agoman page and usage: -D
PatR [Sun, 4 Dec 2022 08:17:50 +0000 (00:17 -0800)]
man page and usage: -D

Mention the changed character name that happens when running in wizard
mode.

2 years agofarlook /[mMoO] feedback, take II
PatR [Sun, 4 Dec 2022 07:51:00 +0000 (23:51 -0800)]
farlook /[mMoO] feedback, take II

Redo the way coordinate pairs are lined up for /m /O &c.

Original
|   <8,9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
Previous
|  <8, 9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
Now
|  <8,9>   $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse

Override right justification instead of inserting a space.  It looks
better for the situation where all y values are 1 digit.

2 years agoanother no_charge sanity check
PatR [Sun, 4 Dec 2022 01:57:29 +0000 (17:57 -0800)]
another no_charge sanity check

Kicking a no_charge item out of a shop wasn't clearing the item's
no_charge flag so trigger sanity warnings.

2 years agoobj->no_charge insanity
PatR [Fri, 2 Dec 2022 23:13:57 +0000 (15:13 -0800)]
obj->no_charge insanity

An object in a shop that was marked no_charge and got removed from
the shop by means other than the hero picking it up (test case
teleported it out while hero was inside shop) was left with the
no_charge bit set.  It's supposed to only be set for objects inside
shops so was triggering the recently added no_charge sanity checks.

Changing stolen_value() to have it pass the reset_nocharge arg to
billable() solves this but could have unanticipated results with
other stealing from shops.

2 years agofarlook /[mMoO] feedback
PatR [Fri, 2 Dec 2022 09:40:54 +0000 (01:40 -0800)]
farlook /[mMoO] feedback

When /m or /M or /o or /O shows monsters or objects with locations
displayed as map coordinates, make those line up by their commas.

Old
|   <8,9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
New
|  <8, 9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
(The data is gathered by row so implicitly sorted by y.)

If someone is crazy enough to set ROWNO to three digits, values
will only line up by the comma when all values have row less than
100 or all are 100+.  Setting COLNO to three digits isn't an issue
unless the total witdh of "<" + xxx + "," + yy ">" is more than 8
(which would push object class letter and object description one or
more extra columns to the right, messing up overall alignment but
still showing accurate data).

2 years agoCI ms-dos build: 1 warning was logged as 2 due to set -x
nhmall [Fri, 2 Dec 2022 05:23:46 +0000 (00:23 -0500)]
CI ms-dos build: 1 warning was logged as 2 due to set -x

2 years agomore fetch-cross-compiler.sh tweaks
nhmall [Fri, 2 Dec 2022 05:20:41 +0000 (00:20 -0500)]
more fetch-cross-compiler.sh tweaks

2 years agoexit on fetch-cross-compile failure, not proceed
nhmall [Fri, 2 Dec 2022 04:58:14 +0000 (23:58 -0500)]
exit on fetch-cross-compile failure, not proceed

2 years agoexit return code
nhmall [Fri, 2 Dec 2022 02:46:19 +0000 (21:46 -0500)]
exit return code

2 years agoin fetch-cross-compiler.sh, stop if required piece failed to download
nhmall [Fri, 2 Dec 2022 01:36:10 +0000 (20:36 -0500)]
in fetch-cross-compiler.sh, stop if required piece failed to download

2 years agoalternate fix issue #938 - use-after-free
PatR [Fri, 2 Dec 2022 00:15:45 +0000 (16:15 -0800)]
alternate fix issue #938 - use-after-free

If you kill an engulfer and get dropped onto a level teleporter or
magic portal, wait until end of turn to perform the level change.
The code to finish off killing the engulfer was left with a stale
pointer for the monster when level change happens immediately.

The level change was being forced to be immediate so that something
noticable happened before being asked for what to name a teleport
scroll read while cursed or confused, but such scrolls become
discovered these days.  So when no prompting for what to call the
scroll takes place, there's no need to change levels instantly.

This issue was just fixed but this commit is simpler.  The previous
fix is left in place in case some other level change path is--or
becomes--possible.

2 years ago\#wizkill fix
PatR [Thu, 1 Dec 2022 23:36:40 +0000 (15:36 -0800)]
\#wizkill fix

When running #wizkill, if hero was swallowed and you killed the
engulfer and that dropped hero onto a level teleporter, the targetting
loop for selecting the next monster to kill kept going after changing
to another level.  Terminate #wizkill if killing something sends you
to a different level.

Not fixed, and an old bug, or variation of one:  the cursor got
positioned at the coordinates of your spot on the prior level even
though the part of the new level where you actually arrived was
displayed.

The hack.c and trap.c bits are just reformatting.

2 years agoRecalc mon-hits-you distance variables
Pasi Kallinen [Thu, 1 Dec 2022 17:57:19 +0000 (19:57 +0200)]
Recalc mon-hits-you distance variables

When a monster could first knock you back and then grab you,
the game would emit impossible, because the knockback moved you
but the distance variables used for the grab attack were not
updated.

Update the range variables within the loop iterating through
the monster attacks.

2 years agoAvoid segfault when null obj passed to water_damage
Pasi Kallinen [Thu, 1 Dec 2022 11:29:52 +0000 (13:29 +0200)]
Avoid segfault when null obj passed to water_damage

2 years agomore shop billing object sanity
PatR [Thu, 1 Dec 2022 10:23:01 +0000 (02:23 -0800)]
more shop billing object sanity

Used up items moved to the billobjs list still have obj->unpaid set.
That should probably be cleared since it has no meaning there, but
this hasn't done that.

For those keeping score:  unpaid checking has triggered three false
positives (so far) and found one bug.

2 years agoUse-after-free with engulfer in xkilled #938
nhmall [Thu, 1 Dec 2022 08:48:11 +0000 (03:48 -0500)]
Use-after-free with engulfer in xkilled #938

If you were on a level teleporter, the spoteffects() call after
the hero gets expelled could end up going to a new level and
freeing all the monst chains from the level you were originally
engulfed on.

    #0 0xba0507 in free
    #1 0x87feda in dealloc_monst src/mon.c:2369
    #2 0x880a02 in dmonsfree src/mon.c:2194
    #3 0x9a7aa2 in savelev_core src/save.c:507
    #4 0x9a7a21 in savelev src/save.c:466
    #5 0x71eb9d in goto_level src/do.c:1483
    #6 0x71833f in deferred_goto src/do.c:1903
    #7 0xa2533f in level_tele src/teleport.c:1117
    #8 0xa2567b in level_tele_trap src/teleport.c:1198
    #9 0xa5c007 in trapeffect_level_telep src/trap.c:1861
    #10 0xa5f856 in trapeffect_selector src/trap.c:2497
    #11 0xa47497 in dotrap src/trap.c:2586
    #12 0x7d669b in spoteffects src/hack.c:2859
    #13 0x89d495 in xkilled src/mon.c:3187

The latter parts of xkilled() after the spoteffects() call would
then attempt to dereference the free'd monst pointer.

Save a copy of the monst struct prior to spoteffects() if you were
expelled, then point at the reference copy afterwards.

Resolves #938

2 years agoMerge branch 'cursed-gold-detection' of https://github.com/vultur-cadens/NetHack...
nhmall [Thu, 1 Dec 2022 04:18:09 +0000 (23:18 -0500)]
Merge branch 'cursed-gold-detection' of https://github.com/vultur-cadens/NetHack into NetHack-3.7

2 years agoFix autodescribe after reading a cursed scroll of gold detection
vultur-cadens [Thu, 1 Dec 2022 01:34:00 +0000 (17:34 -0800)]
Fix autodescribe after reading a cursed scroll of gold detection

Autodescribe was not updating during browse_map() when the cursor was
moved over a gold glyph that was actually a trap, causing the trap to
be described as the previous square that the cursor was on (probably
"unexplored area") instead of as gold pieces.  This was especially
noticeable when using OPTIONS=whatis_coord:m, because the coordinate
was not updating when moving the cursor over the trap.

2 years agoanother manpage update
PatR [Thu, 1 Dec 2022 00:32:43 +0000 (16:32 -0800)]
another manpage update

Split some lines that began with one sentence and then continued with
another so that each sentence has its own line as per 'roff guidelines.

Change the continuation lines in the files and environment sections
to begin with <backslash><space><tab> instead of just <tab>, again to
meet the guidelines (don't begin lines with whitespace).  This had a
side-effect of suppressing some space insertion for justifying right
margin of right-hand column on some of the lines.  That hadn't looked
very good anyway.

Add new file 'usagehlp' to the files section.

Also add previously unmentioned Guidebook[.txt], but it's hard to
explain why it probably won't be present....

Update the bones file entry.

'cmdhelp' isn't used anymore.  Should it be moved to outdated/dat and
the Makefile install steps be updated to stop bothering with it?

2 years agofixes entry for pull request #937 - stale memory
PatR [Wed, 30 Nov 2022 22:58:59 +0000 (14:58 -0800)]
fixes entry for pull request #937 - stale memory

Pull request from entrez:  memory freed when changing levels could be
accessed if the level change happened when hero caused an engulfer to
expel him onto a level teleporter.  Wouldn't happen when monsters are
moving because hero's level change will be deferred.  Wouldn't happen
for trap doors and holes, but could happen for magic portal if hero
got swallowed while on one after coming through from other side.

Fixes #937

2 years agoFix: potential use-after-free in expels()
Michael Meyer [Mon, 28 Nov 2022 22:16:21 +0000 (17:16 -0500)]
Fix: potential use-after-free in expels()

An engulfing monster can expel you onto a level teleporter or other
level-changing trap, in which case it may (under highly specific
circumstances[1]) no longer have been in memory by the time mtmp->mx/my
were accessed to see whether the "Brrooaa" message should be printed.
It also doesn't make much sense to print that message by the time you've
already fallen through a portal, trapdoor, etc, onto another level, so I
think moving it before the spoteffects() call kills two birds with one
stone.

[1] The highly specific circumstances: you must die due to illness or
some other timeout (or generally die on your own turn rather than the
monsters' turn, since this ensures the level change isn't deferred until
the end of the turn), while engulfed above a level teleporter [or maybe
another similar trap -- I tested with a level teleporter], and be
lifesaved, while positioned such that the engulfer can't follow you
through the levelport after expulsion (e.g. surrounded by other
monsters).  It may happen under some other conditions too, but even if
so it's pretty rare and was tough to reproduce.

2 years agomore #936 - water vs potions of acid
PatR [Wed, 30 Nov 2022 22:49:11 +0000 (14:49 -0800)]
more #936 - water vs potions of acid

Pull request #936 took away the destruction of potions of acid ("acid
and water don't mix") if they survived water_damage().  Restore that
by forcing them to not survive.  Exception:  if they're greased and
pass the 50:50 chance of retaining the grease, they aren't destroyed.

2 years agopull request #936 - feedback for grease wash off
PatR [Wed, 30 Nov 2022 20:56:16 +0000 (12:56 -0800)]
pull request #936 - feedback for grease wash off

Pull request from entrez:  if a greased item loses its grease after
being affected by water, say so.

Also, the post-water code could access freed memory for an item that
had been destroyed by the water (potion of acid).

Fixes #936

2 years agoFix: use-after-free when fountain dipping
Michael Meyer [Mon, 28 Nov 2022 20:44:27 +0000 (15:44 -0500)]
Fix: use-after-free when fountain dipping

A potion of acid could be destroyed and freed by dipping into a
fountain, then dereferenced after the fact -- both when checking its
type immediately after the water_damage() call (as was noticed by
hackemslashem and amateurhour on IRC), and also in the later switch/case
a few lines further down in dipfountain().

I basically reversed the original 'er != ER_DESTROYED' test here: as it
was before this, I think the only thing that could hit it was a greased
potion of acid, which would survive the initial dip due to the grease.
Such a potion would be silently deleted.  Potions of acid which were
actually destroyed by water_damage, on the other hand, could be allowed
to continue down to the switch/case of further effects (and associated
dereferences).  I think this makes more sense in reverse, with potions
that were protected by grease actually being protected and producing
normal dip effects, and potions of acid which exploded causing an early
return with no further effects.  This effectively prevents the various
use-after-free scenarios that were possible, too.