]> granicus.if.org Git - nethack/log
nethack
2 years agoalloc.c: add missing NORETURN
keni [Tue, 10 Jan 2023 20:55:30 +0000 (15:55 -0500)]
alloc.c: add missing NORETURN

2 years agoMore interesting Gehennom levels
Pasi Kallinen [Mon, 9 Jan 2023 20:25:23 +0000 (22:25 +0200)]
More interesting Gehennom levels

Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.

2 years agoidentifying via menu
PatR [Tue, 10 Jan 2023 07:34:32 +0000 (23:34 -0800)]
identifying via menu

From the newsgroup:  identifying by menu pops up multiple menus in
succession if the player picks fewer invent entries than are being
granted, but the second and subsequent ones could cover up the
message window and hide the feedback from prior ones.

If multiple popup menus are needed when identifying, issue --More--
before each menu after the first.  The code seemed to be trying to
do this already, but it should have used wait_synch() rather than
mark_synch(), or perhaps used display_nhwindow(WIN_MESSAGE, TRUE)
instead of either one of those.  For curses, both mark_synch() and
wait_synch() were no-ops.  Now they do something.  X11's behavior
wasn't right either; it seemed to be lagging one message behind
(something I had noticed recently and then forgotten about; I still
don't remember the context then so don't know whether this fixes
that earlier situation).

2 years agoallow full-line comments in tiles source files
PatR [Sun, 8 Jan 2023 09:33:18 +0000 (01:33 -0800)]
allow full-line comments in tiles source files

Accept
<start of line><optional whitespace>#<anything>
as a comment in win/share/{monsters,objects,other}.txt.  Existing
<start of line><optional whitespace># tile <rest of line>
is grandfathered in as data.

It wouldn't take much more to accept
<data><optional whitespace>#<rest of line>
comments too but this hasn't gone that far.

Reading the colormap at the beginning of each of the three files
used "%[A-Za-z0-i]" to read one characer into a two-character array.
Change that to "%1[A-Za-z0-9]" so that it can't overflow the buffer
if the input data gets accidentally or maliciously mangled.  (Not a
security issue.)

Remove a spurious blank line from objects.txt.

Also, clean up some warnings when compiling gifread.c for gif2txt
although I ultimately didn't do anything with that.

2 years agofix for onefile FITSint, FITSuint
PatR [Sat, 7 Jan 2023 20:48:10 +0000 (12:48 -0800)]
fix for onefile FITSint, FITSuint

I assumed that the complaint about macro refinition was for the two
in alloc.c replacing two from hack.h from another file, but it could
be that those being defined by alloc.c were interferring with the
regular hack.h ones.  alloc.c doesn't need them, and was also skipping
an opportunity to use one of them.

2 years agoAnother valgrind uninitialized bytes complaint
Pasi Kallinen [Sat, 7 Jan 2023 15:28:14 +0000 (17:28 +0200)]
Another valgrind uninitialized bytes complaint

2 years agoSilence valgrind uninitialized bytes complaints
Pasi Kallinen [Sat, 7 Jan 2023 11:20:39 +0000 (13:20 +0200)]
Silence valgrind uninitialized bytes complaints

Just zero out the allocated memory.

Explicitly setting struct field values isn't enough, because field alignment
means there can be several unused bytes which are written to savefile.

2 years agoFix lua selection logical-or bounds
Pasi Kallinen [Sat, 7 Jan 2023 08:55:05 +0000 (10:55 +0200)]
Fix lua selection logical-or bounds

2 years agoFree command queues at end of game
Pasi Kallinen [Fri, 6 Jan 2023 14:40:54 +0000 (16:40 +0200)]
Free command queues at end of game

At end of game, the disclose prompts put commands into the queue,
but those weren't freed.

2 years agoRemove NO_VSNPRINTF
Pasi Kallinen [Fri, 6 Jan 2023 13:53:03 +0000 (15:53 +0200)]
Remove NO_VSNPRINTF

Affects only ancient VMS where vsnprintf wasn't available.

2 years agoshow_glyph() impossible
PatR [Tue, 3 Jan 2023 07:40:06 +0000 (23:40 -0800)]
show_glyph() impossible

After glyph expansion a while back, a few 'if's had tests of
|  else if ((offset = (foo - bar)))
which should be
|  else if ((offset = (foo - bar)) >= 0)
Only used if show_glyph() has been passed invalid map coordinates
so never seen.

2 years agoscore feedback punctuation
PatR [Tue, 3 Jan 2023 07:25:38 +0000 (23:25 -0800)]
score feedback punctuation

"Killed by Ms. Manlobbi, the shopkeeper" has the comma changed to
a semi-colon prior to being stored in 'record'.  That's intentional,
but "Killed by Ms. Manlobbi; the shopkeeper" looks strange when shown
to the player.  Change semi-colon back to comma when writing scores
for display.

2 years agostriking/force-bolt comment
PatR [Mon, 2 Jan 2023 22:25:23 +0000 (14:25 -0800)]
striking/force-bolt comment

I'm not sure whether newsym_force() is still necessary, but add a
comment about why it's being used in bhito().

2 years agostatic analyzer bit display.c
nhmall [Mon, 2 Jan 2023 21:06:11 +0000 (16:06 -0500)]
static analyzer bit display.c

A static analyzer pointed out that the 'if' was checking
for null pointer, but the 'else' was not, yet they were
both then dereferencing the same variable.

2 years agonethack --windowtype=badchoice
PatR [Mon, 2 Jan 2023 01:35:06 +0000 (17:35 -0800)]
nethack --windowtype=badchoice

If you used the commandline to ask for an interface that doesn't exist
or isn't available, you'd get complaints about it not being recognized
twice.  First before any other options, then again after regular
option processing has taken place.  Clear the command line setting if
the first attempt gets rejected so that it won't be retried later and
be rejected again.  Probably the game should just quit if setting the
interface fails.

2 years agoGuidebook update
nhmall [Mon, 2 Jan 2023 01:23:15 +0000 (20:23 -0500)]
Guidebook update

2 years agoupdate for tilemap.c generated tile.c code
nhmall [Mon, 2 Jan 2023 01:05:59 +0000 (20:05 -0500)]
update for tilemap.c generated tile.c code

2 years agoadd some curses support for coloring of map frame
nhmall [Mon, 2 Jan 2023 01:05:03 +0000 (20:05 -0500)]
add some curses support for coloring of map frame

2 years agointroduce X11 support for coloring map frame
nhmall [Mon, 2 Jan 2023 01:04:27 +0000 (20:04 -0500)]
introduce X11 support for coloring map frame

2 years agointroduce Qt support for color of map frame
nhmall [Mon, 2 Jan 2023 01:03:30 +0000 (20:03 -0500)]
introduce Qt support for color of map frame

2 years agointroduce support for coloring the frame behind a map location
nhmall [Mon, 2 Jan 2023 00:55:02 +0000 (19:55 -0500)]
introduce support for coloring the frame behind a map location

Also includes support by paxed for polearm targeting using the
frame color.

Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.

Not all window interfaces have full support for the color framing
of the background square yet.

MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.

Windows GUI is missing support.

X11 and Qt have been started, but may require further refinement.

2 years agoupdate year in copyright
nhmall [Sun, 1 Jan 2023 22:31:34 +0000 (17:31 -0500)]
update year in copyright

2 years agocomment fix in display.c
PatR [Sun, 1 Jan 2023 08:21:51 +0000 (00:21 -0800)]
comment fix in display.c

A comment in front of unmap_object() was missing the end of a
sentence in the middle of a short paragraph.  That has been the case
as far back as 3.3.0.  I found the sentence's full text in 3.2.0
(without checking 3.2.[123]).  The rest of the paragraph got changed,
presumably at the same time as the missing part got lost.

While in there, change "any more" to "anymore".  According to a
dictionary, the one-word form is the more commonly usage.

2 years agofix tilemap - no panic()
PatR [Sat, 31 Dec 2022 21:35:17 +0000 (13:35 -0800)]
fix tilemap - no panic()

tilemap isn't linked with util/panic.o so doesn't have access to
panic().  Despite that, linking on OSX found panic() somewhere.
(It doesn't do format argument substitution, just prints out the
argument we pass as format string, then aborts.)

Instead of calling panic(), print a message to stderr, delete the
incomplete tile.c whose construction has failed, and exit with
failure status.  Linking with panic.o wouldn't handle the message
and final failure but not help with the incomplete output file part,
so this hasn't done that.

2 years agopull request #942 - shopkeeper chat changes
PatR [Sat, 31 Dec 2022 20:42:52 +0000 (12:42 -0800)]
pull request #942 - shopkeeper chat changes

Pull request from entrez:  change some pline() messages to verbalize()
and re-enable some chat feedback given when a shopkeeper is poly'd
into some form that can't speak.

Closes #942

2 years agoUse verbalize for shopkeeper price-check #chatting
Michael Meyer [Fri, 2 Dec 2022 17:45:00 +0000 (12:45 -0500)]
Use verbalize for shopkeeper price-check #chatting

The shopkeeper is speaking out loud, so use verbalize for consistency
with other types of speech.

I couldn't figure out a way to wrap the multiline version in quotes in a
way that actually worked and looked good, so I restricted this to the
pline responses.

2 years agoTweaks to chatting with mute shopkeeper
Michael Meyer [Fri, 2 Dec 2022 17:32:35 +0000 (12:32 -0500)]
Tweaks to chatting with mute shopkeeper

A mute shopkeeper shouldn't be able to verbally tell you the prices of
objects.  For normal chatting, on the other hand, shk_chat can handle a
mute shopkeeper (by changing from speech to "indications" -- hand signs,
body language, etc), so allow execution to reach that even if the
shopkeeper is mute (in a silent polyform).

Also more generally allow a shopkeeper to continue chatting with normal
shopkeeper responses if polymorphed into another creature, since they
apparently retain their minds (are able to tell you prices, can
transact, etc).

This is mostly inspired by the fact shk_chat has extensive handling for
mute shopkeepers, but it was unreachable as far as I can tell.  It is
also funny to think of a newt or something wriggling around to indicate
it's been making a lot of money lately.

2 years agopull request #939 - revise #wizsmell command
PatR [Sat, 31 Dec 2022 20:13:41 +0000 (12:13 -0800)]
pull request #939 - revise #wizsmell command

Pull request from entrez:  add a funny message if player targets hero
with #wizsmell command.

I've modified it to put a "remembered, unseen monster" symbol on the
map if sniffing a non-monster location reports a monster's smell and
to remove that symbol if sniffing it reports "no monster there".

Closes #939

2 years agosmelling an unseen monster puts 'I' on map
PatR [Sat, 31 Dec 2022 20:11:28 +0000 (12:11 -0800)]
smelling an unseen monster puts 'I' on map

2 years agoRemove canspotmon() requirement from #wizsmell
Michael Meyer [Thu, 1 Dec 2022 22:56:00 +0000 (17:56 -0500)]
Remove canspotmon() requirement from #wizsmell

You can attempt to smell a monster at particular coordinates even if you
can't see it.  Revert the message for the 'can't find a monster there to
smell' case to "That is not a monster", as it was before, since the
change makes it so that you only reach that line if there genuinely is
no monster there (previously it would be reached if there was a hidden
or undetected monster on the specified spot).

2 years agoAdd a funny message for smelling yourself
Michael Meyer [Tue, 29 Nov 2022 03:37:34 +0000 (22:37 -0500)]
Add a funny message for smelling yourself

I know this is inane, especially for a little-used debug-mode-only
command, but I can't get it out of my head...

The use of the actual monster data instead of the glyph as a proxy ought
to make it somewhat more consistent as well (e.g. hallucination and
'showrace' won't affect the results), though I think that'd hardly be
worth it were it not for the incredibly funny message.

2 years agofixes entry for pull request #920 - paralyzed hero
PatR [Sat, 31 Dec 2022 19:28:13 +0000 (11:28 -0800)]
fixes entry for pull request #920 - paralyzed hero

Pull request from entrez:  hero needs to be able to move in order to
help a nymph or succubus or incubus to remove worn armor.

Closes #920

2 years agoMake paralysis intefere with seduction attempts
Michael Meyer [Thu, 3 Nov 2022 18:03:00 +0000 (14:03 -0400)]
Make paralysis intefere with seduction attempts

tinklebear on IRC noticed that a hero paralyzed by a floating eye was
still "charmed" and capable of "removing her armor" as part of a nymph's
theft attack.  The same thing was true of foocubus seduction: a
paralyzed hero was still able to respond to the questions about whether
particular pieces of armor should be removed (and also do whatever else
may be involved in a successful attack...).

I think paralysis should prevent both those things.  Nymph theft will
still work, unless she needs the hero's active cooperation in removing a
bulky piece of armor.  Foocubus attacks will be prevented entirely by
paralysis, making it interfere like unconsciousness already does.

Apply a similar constraint to hero vs monster seduction, as well.

2 years agosome tilemap.c cleanup
PatR [Fri, 30 Dec 2022 20:45:02 +0000 (12:45 -0800)]
some tilemap.c cleanup

I'm headed back to the drawing board for some tiles changes I was
attempting, but before tossing what I had I've extracted a modest
amount of cleanup for the code in win/share/tilemap.c.  Some
formatting, a bit of generated formatting, make ENHANCED_SYMBOLS
less intrusive, and an error check to prevent a crash in tilemap
I triggered.  Also avoid one in nethack caused by an object (not
included here) which had a description but no name.

2 years agoGuidebook typo
PatR [Wed, 28 Dec 2022 19:37:14 +0000 (11:37 -0800)]
Guidebook typo

Fix misspelling of recently added "sortvanquished" option.
Copy+paste propagated it to from Guidebook.mn to Guidebook.tex.

2 years agofollowup for miscellaneous objects[] macros
PatR [Wed, 28 Dec 2022 19:33:39 +0000 (11:33 -0800)]
followup for miscellaneous objects[] macros

The DUMP_ENUMS definition of 'MARKER()' had the expansion of its
arguments backwards but isn't even needed, so get rid of it rather
than reverse them.  nethack --dumpenums handles them separately
from object definitions.

2 years agomiscellaneous objects[] macros
PatR [Wed, 28 Dec 2022 09:50:24 +0000 (01:50 -0800)]
miscellaneous objects[] macros

Replace FIRST_GEM and LAST_GEM with FIRST_REAL_GEM, LAST_REAL_GEM,
FIRST_GLASS_GEM, and LAST_GLASS_GEM and define those along with
objects[] rather than separately.  Do the latter for FIRST_AMULET
and LAST_AMULET too.  Also new FIRST_SPELL and LAST_SPELL used to
compute MAXSPELLS.  (That value looks wrong to me, but this defines
it with the same value as before.  If it gets fixed, EDITLEVEL will
need to be incremented.)

This started as just proof of concept that extra information could
be collected as objects[] gets initialized at compile time.

2 years agoGuidebook datestamp
nhmall [Wed, 28 Dec 2022 02:03:41 +0000 (21:03 -0500)]
Guidebook datestamp

2 years ago'sortvanquished' option in Guidebook.tex
PatR [Tue, 27 Dec 2022 22:15:49 +0000 (14:15 -0800)]
'sortvanquished' option in Guidebook.tex

Not tested, but I tried to be more careful than last time....

2 years agonew 'sortvanquished' option
PatR [Mon, 26 Dec 2022 22:56:12 +0000 (14:56 -0800)]
new 'sortvanquished' option

Allow the preferred sort order for the vanquished monsters list to
be specified in the run-time config file
|OPTIONS=sortvanquished:X
where X is t, d, a, c, n, or z.  It can also be set to 'A' or 'C'
but those aren't documented and aren't offered as choices when
setting the value interactively, which can be done via 'm O' or by
using 'm #vanquished'.

Guidebook.mn has been updated but Guidebook.tex is lagging again.

2 years agoboomerang bits
PatR [Sun, 25 Dec 2022 21:28:02 +0000 (13:28 -0800)]
boomerang bits

Refine the recent throw-and-return catching routine.

2 years ago{freez,flam,shock}ing spheres difficulty ratings
PatR [Sun, 25 Dec 2022 21:21:56 +0000 (13:21 -0800)]
{freez,flam,shock}ing spheres difficulty ratings

Adjust mstrength() so it generates difficulty assessments matching
the mons[].difficulty values for freezing spheres, flaming spheres,
and shocking spheres.  #wizmodiff now reports "no discrepancies".

2 years agoGuidebook datestamp; updated Guidebook.txt
nhmall [Sun, 25 Dec 2022 15:12:47 +0000 (10:12 -0500)]
Guidebook datestamp; updated Guidebook.txt

2 years agomake some corrections to Guidebook.tex
nhmall [Sun, 25 Dec 2022 15:09:43 +0000 (10:09 -0500)]
make some corrections to Guidebook.tex

2 years agodoc update: 'role' changes for Guidebook.tex
PatR [Sat, 24 Dec 2022 22:29:58 +0000 (14:29 -0800)]
doc update: 'role' changes for Guidebook.tex

Catch the LaTex Guidebook up with the nroff one for the role, race,
gender, and alignment options.

For both formats, comment out the decription of 'altmeta' on Amiga.

2 years agofix boomerang equiped in multiple slots
PatR [Sat, 24 Dec 2022 08:27:59 +0000 (00:27 -0800)]
fix boomerang equiped in multiple slots

Reported directly to devteam:  with one quivered boomerang and a
compatable stack of one or more boomerangs either wielded or in the
alternate weapon slot, throwing the quivered one, failing to hit any
target or obstacle, and catching the returning boomerang would empty
the quiver, merge the caught boomerang with the wielded weapon or
swap-weapon slot, then re-quiver and yield
|x - 2 boomerangs (wielded) (at the ready)
or
|y - 2 boomerangs (alternate weapon; not wielded) (at the ready)
If 'sanity_check' was On, complaints would ensue.

'autoquiver' may need to be On in addition to the thrown boomerang
being the last item in the quiver.

The unsplit portion of the fix feels unclean.  There's bound to be a
better way.

2 years agodismount tidbit
PatR [Fri, 23 Dec 2022 23:42:08 +0000 (15:42 -0800)]
dismount tidbit

I just noticed a couple of direction manipulaton macros that I hadn't
been aware of.  Change recenlty added DISMOUNT_KNOCKED to use them.

2 years agomemory not freed
nhmall [Fri, 23 Dec 2022 21:38:53 +0000 (16:38 -0500)]
memory not freed

Reported directly by feedback form.

Changes from a recent pull request resulted in more array entries
than MAX_GLYPH, so the for loop in free_glyphid_cache() wasn't going far
enough, leaving some dupstr() strings unfreed.

2 years agolast? role/race/&c option values update
PatR [Thu, 22 Dec 2022 23:07:33 +0000 (15:07 -0800)]
last? role/race/&c option values update

Keep track of how a role|race|gender|alignment option got its value
so that role:!Tourist in .nethackrc and role:!Priest in NETHACKOPTIONS
yield 'role:!Priest' rather than merging into 'role:!Priest !Tourist'.
It also doesn't write the value into new config file for #saveoptions
if that value comes from environment or command line (not applicable
since the command line arguments for role,&c don't go through options
handling).  Also, the old config file value takes precedence over
the current game's value file so that 'role:random' doesn't become
'role:Healer' or such in a new config after the random value gets
picked for play.

This only tracks the role, race, gender, and alignment options but the
concept could be extended to all options.  The data would need to be
saved and restored if values set interactively need to be retained in
restore sessions (doesn't apply to role,&c since those don't change
during play).

2 years agoAdd themeroom filler "Storeroom"
Pasi Kallinen [Thu, 22 Dec 2022 19:47:10 +0000 (21:47 +0200)]
Add themeroom filler "Storeroom"

Contains mostly mimics (pretending to be chests), and possibly some chests.

2 years agoold pull request #609 - neutral #offer feedback
PatR [Wed, 21 Dec 2022 22:31:13 +0000 (14:31 -0800)]
old pull request #609 - neutral #offer feedback

Pull request from Vivit-R was to change feedback when offering on a
neutral altar from "your sacrifice is consumed in a cloud of smoke"
to "... in a puff of smoke".  There were multiple comments, some
agreeing and some disagreeing but no better alternatives offered.

I'm ambivalent to whether any alteration was needed, but think "puff"
sounds rather passive.  I looked at a lot of synonyms and considered
"veil of smoke" and "haze of smoke" and even "puff of vapor", but
finally settled on "plume of smoke".  It isn't something that appears
and is gone in an instant like the lawful flash of light and chaotic
burst of flame, but I think it is more interesting than cloud or puff.

The PR's commit hasn't been used since 100% of its content is being
superseded.

Closes #609

2 years agosequencing issue: dismounting from dying steed
PatR [Wed, 21 Dec 2022 22:02:05 +0000 (14:02 -0800)]
sequencing issue:  dismounting from dying steed

Reported by entrez:   if a trap killed hero's steed and dismounting
was fatal for the hero (probably by falling onto the same trap),
impossible "dmonsfree: 1 removed doesn't match 0 pending" warning
occurred during game-over cleanup.

Move the dismount calls in mondead() and mongone() from before their
m_detach() call to the end of m_detach() itself.  This led to a
cascade of problems and attempted fixes until finally zeroing in on
place_monster()'s sanity checks and dismount_steed()'s attempts to
work-around one of them.

This reverts the convoluted hack from four years ago in commit
be327d9822a17823a86553bb33d414ba56522fd4 and deals with the issue in
a simpler way.  After that, the new dismount_steed() placement at
end of m_detach() works cleanly.

2 years agopull request #951 - Guidebook tweak for #repeat
PatR [Wed, 21 Dec 2022 07:38:54 +0000 (23:38 -0800)]
pull request #951 - Guidebook tweak for #repeat

Pull request from entrez:  in TeX version of Guidebook, the #repeat
command was formatted differently from other extended commands.

(The recent changes to role, race, gender, and alignment options in
Guidebook.mn still haven't made it into Guidebook.tex.)

Closes #951

2 years agoGuidebook: formatting for '#repeat' heading
Michael Meyer [Tue, 20 Dec 2022 22:18:15 +0000 (17:18 -0500)]
Guidebook: formatting for '#repeat' heading

Minuscule change.  #repeat was not monospaced like the other extended
commands.

2 years agomore PR #902 - excising "Current"
PatR [Wed, 21 Dec 2022 07:31:49 +0000 (23:31 -0800)]
more PR #902 - excising "Current"

Change ^X feedback of "Current Characteristics" to just
"Characteristics" to match the change for "Status" and "Attributes".

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.]