]> granicus.if.org Git - nethack/log
nethack
2 years agofix #H5459 - explosions and steeds
PatR [Sun, 25 Sep 2022 08:21:07 +0000 (01:21 -0700)]
fix #H5459 - explosions and steeds

Reported nearly five and half years ago:  mounted hero and steed
shared resistances if they got hit by an explosion.

2 years agofix "unique monster doppelganger and bones bug"
PatR [Sun, 25 Sep 2022 01:49:48 +0000 (18:49 -0700)]
fix "unique monster doppelganger and bones bug"

Reported by paxed 8 years ago:  if a bones file contains a
doppelganger imitating a unique monster, when it gets loaded
that monster ends up being marked as having been created.  The
doppelganger itself will shapechange to other forms, but the
unique monster won't be created when it should be because it has
become extinct.

Report involved creating a statue of a unique monster which
yields a doppelganger in that monster's shape, then using stone
to flesh to animate the statue, dying before it changes to some
other shape, and having bones be saved.

2 years agopull request #850 - level teleporter feedback
PatR [Sat, 24 Sep 2022 22:27:13 +0000 (15:27 -0700)]
pull request #850 - level teleporter feedback

Pull request from copperwater:  don't give "flash of light" feedback
when activating a level teleporter because it's too much like one of
the outcomes of a magic trap.

This doesn't use the suggested commit.  Getting the "you feel
disoriented" feedback before being asked for destination level (when
having teleport control) seemed contradictory.  This gives different
feedback and does so after the actual teleport.

Supersedes #850
and since nhcopier doesn't seem to understand "supersede"
Closes #850

2 years agoalloc() never returns Null
PatR [Sat, 24 Sep 2022 11:39:12 +0000 (04:39 -0700)]
alloc() never returns Null

Mark alloc()--also dupstr() and re_alloc()--for gcc and clang as
always returning non-Null.  This should silence some of the static
analysis complaints.

Almost all the monster and object naming functions (anything that
returns an mbuf or an obuf) should be marked this way too but I'll
leave that for somebody else to deal with.

I didn't attempt to mark alloc() with the 'malloc' attribute because
macro definitions could end up causing trouble.  Specifying its
deallocator would probably be useful but is at even bigger risk of
macro interference.

I'm not sure whether gcc 3 is really the right test for whether the
returns_nonnull attribute setting is available.

2 years agoFix curses cursor keys
Pasi Kallinen [Sat, 24 Sep 2022 07:40:34 +0000 (10:40 +0300)]
Fix curses cursor keys

My change to allow fuzzer run in curses caused the cursor keys
to not work (eg. paging through menus with left and right cursor),
so fix that.

2 years agoitalic attribute on tty
PatR [Sat, 24 Sep 2022 06:37:02 +0000 (23:37 -0700)]
italic attribute on tty

If switching to italic isn't supported for tty, switch to underline
instead.  Comparable to the curses interface.

2 years agofix github issue #581 - "You see no door there."
PatR [Fri, 23 Sep 2022 22:30:00 +0000 (15:30 -0700)]
fix github issue #581 - "You see no door there."

Year old issue from copperwater:  'open' directed at a non-door told
player that there isn't a door and took no time unless character was
blind and learned what type of terrain it is, applying a key gave
the same message but used a turn and didn't update map to reflect any
terrain discovery.

Attempting to open an adjacent door or applying a key to one while in
a pit had a similar issue:  they produced the same "you can't reach
it from here" but had different time vs no-time outcome.

There may be other actions in the same situation.

Closes #581

2 years agogithub PR #868 - fix replacement of 'w' terrain
PatR [Fri, 23 Sep 2022 06:56:31 +0000 (23:56 -0700)]
github PR #868 - fix replacement of 'w' terrain

Pull request from copperwater:  terrain replacement couldn't match
'w' because it only checked actual terrain types.

Fixes #868

2 years agoMake replace_terrain respect fromterrain='w'
copperwater [Sun, 4 Sep 2022 16:31:45 +0000 (12:31 -0400)]
Make replace_terrain respect fromterrain='w'

Noticed that an attempted terrain replacement wasn't taking hold even
though 'w' is supposed to mean "match any stone or wall"; this was
because w converts into non-terrain-type MATCH_WALL and replace_terrain
was doing a simple comparison on whether the potentially replaced
terrain matches that type. Add a special check here for w so it will
match the terrain types it's supposed to.

Note that using replace_terrain with 'w' now WILL match stone, since
this is the documented behavior of w, to match IS_STWALL rather than
just IS_WALL. If a level designer really wants to exclude stone, they
can work around this by either making a selection and filter out stone
terrain, or doing two replace_terrains with '-' and '|'.

2 years agofixes entry for PR #848 - no traps in Tou shops
PatR [Fri, 23 Sep 2022 06:43:36 +0000 (23:43 -0700)]
fixes entry for PR #848 - no traps in Tou shops

Pull request from copperwater:  the random traps specified by the
special level definitions of the tourist locate and goal levels could
be placed inside the shops present on those levels.

Fixes #848

2 years agoFix: prevent traps in shops in the Tourist quest
copperwater [Sun, 14 Aug 2022 00:04:25 +0000 (20:04 -0400)]
Fix: prevent traps in shops in the Tourist quest

The Tourist locate and goal levels have 2 shops each, and also have
various traps randomly placed on the level. Unfortunately, this does not
account for placing them in the shops, so it was possible to wind up
with a magic trap or falling rock trap or whatever inside the shop,
which the shopkeeper would not clean up.

This commit makes selections that exclude the shop areas, and picks the
traps from those selections, keeping the shop floors trap-free as their
customers expect.

2 years agodgn_bottom() fix
PatR [Fri, 23 Sep 2022 06:16:19 +0000 (23:16 -0700)]
dgn_bottom() fix

Use the level passed in instead of the hero's location when checking
the dungeon branch.

It probably doesn't make any difference, but use the argument that's
already being provided.

2 years agovibrating square
PatR [Thu, 22 Sep 2022 23:50:41 +0000 (16:50 -0700)]
vibrating square

Give a [probably pointless] hint if the player tries to move '>'
while on the vibrating square.

2 years agorefine bottom of Gehennom check
PatR [Thu, 22 Sep 2022 23:47:37 +0000 (16:47 -0700)]
refine bottom of Gehennom check

In the quest branch, dbg_bottom() returns a barrier level rather
than actual bottom.  Do things the same way for the gehennom branch.

2 years ago'fix' #K3716 - engraving with Fire Brand
PatR [Thu, 22 Sep 2022 23:09:22 +0000 (16:09 -0700)]
'fix' #K3716 - engraving with Fire Brand

Add a comment to the effect that engraving with Fire Brand doesn't
cause it to become dull.

[I'm not sure that is the behavior we really want.  It seems like an
unintended side-effect of changing Fire Brand's engrave type to BURN.]

2 years ago'fix' #K3676 - artifact_hit()'s magr
PatR [Thu, 22 Sep 2022 22:34:16 +0000 (15:34 -0700)]
'fix' #K3676 - artifact_hit()'s magr

Someone asked whether the 'magr' argument to artifact_hit() can be
Null or not since the code sometimes checks whether it is Null and
other times uses it unconditonally.  The answer is "it depends."
Can't reply to asker due to forced anonymity when the contact form
was submitted.

2 years agoCurses: enable debug fuzzer
Pasi Kallinen [Thu, 22 Sep 2022 10:10:13 +0000 (13:10 +0300)]
Curses: enable debug fuzzer

2 years agoPrevent impossible fall dmg if falling up
Michael Meyer [Thu, 22 Sep 2022 02:19:42 +0000 (22:19 -0400)]
Prevent impossible fall dmg if falling up

The way hole destinations work now theoretically allows for a
cross-branch hole or trap door to move you across branches in a way that
decreases your overall depth.  If this happened, it would cause an
impossible when the negative result of (depth(new) - depth(old)) was
used to calculate fall damage.  Limit fall damage to 1d6 if dist <= 0.

2 years agoApply trap door destination restrictions in dodown
Michael Meyer [Thu, 22 Sep 2022 01:25:25 +0000 (21:25 -0400)]
Apply trap door destination restrictions in dodown

Missed this way to use the trap door (in a block added in 05761ba) in
previous commits, though I'm a little confused about whether that block
in dodown is even reachable given how various trap scenarios are handled
with dotrap earlier in the function.

2 years agoApply dest. limit to monster trap door usage
Michael Meyer [Thu, 22 Sep 2022 00:19:33 +0000 (20:19 -0400)]
Apply dest. limit to monster trap door usage

To prevent monsters from falling past the bottom level or into the
sanctum early, and to maintain consistency between monster and hero hole
usage.

2 years agoRefine attempt to clamp trap door fall destination
Michael Meyer [Thu, 22 Sep 2022 00:06:35 +0000 (20:06 -0400)]
Refine attempt to clamp trap door fall destination

This should prevent anyone from exploiting falling into the sanctum (by
taking advantage of a trap door in a bones file from a differently
laid-out dungeon, as described in the previous commit) to bypass the
invocation, in addition to falling past the actual end of the dungeon.

2 years agoPrevent hero from falling past end of dungeon
Michael Meyer [Wed, 21 Sep 2022 23:55:04 +0000 (19:55 -0400)]
Prevent hero from falling past end of dungeon

Similar story with saved trap door destinations: if a bones file near
the end of the dungeon came from a longer dungeon (i.e. with a
lower-depth castle) than the one the bones file is loaded into, the
trap door destination could be past the dungeon end.  Clamp the
destination so it won't be lower than the bottom level of the dungeon.

2 years agoHave monsters' hole destination match the hero's
Michael Meyer [Wed, 21 Sep 2022 23:44:27 +0000 (19:44 -0400)]
Have monsters' hole destination match the hero's

The fixed destination of a hole or trap door was being used for the hero
but not for monsters.  Make everyone land in the same place, so you can
chase a monster into a hole and actually find it.

2 years agoFix: antigravity trap doors
Michael Meyer [Wed, 21 Sep 2022 23:41:45 +0000 (19:41 -0400)]
Fix: antigravity trap doors

Trap doors saved their destinations as an absolute level, rather than a
relative one, so if you loaded bones from a special level their
destinations would reflect the dungeon layout from the bones player's
game.  For example, die on the Oracle level, on dlvl5, with a trap door
that goes to dlvl6.  Another player gets those bones on their Oracle
level, which is dlvl8... the trap door would still go to dlvl6.  Pretty
amazing trap door -- something you might see in a funhouse!

Include relative rather than absolute destinations in save and bones
files, much like stairs do, to avoid this problem.

I bumped EDITLEVEL because although this won't break save files in an
obvious way, it will interpret the (absolute) destinations in existing
save and bones files as relative, leading to some crazy long falls. :)

2 years agogithub pull request #628 - duplicate code
PatR [Thu, 22 Sep 2022 00:02:45 +0000 (17:02 -0700)]
github pull request #628 - duplicate code

Pull request from argrath nearly a year ago: an 'if' and corresponding
'else' have the same code so there's no point in testing for if/else.

I'm still not convinced that simply removing the if/else is the right
fix here but nothing else is going on.  I've put part of the removed
code back inside '#if 0' in case it needs to be resurrected someday.

Closes #628

2 years agoremove duplicate code
SHIRAKATA Kentaro [Sun, 31 Oct 2021 10:04:45 +0000 (19:04 +0900)]
remove duplicate code

Here, `then` clause and `else` clause is identical.

2 years agogithub PR #879 - pets eating shapeshifter corpses
PatR [Wed, 21 Sep 2022 19:07:05 +0000 (12:07 -0700)]
github PR #879 - pets eating shapeshifter corpses

Pull request from entrez:  the check for whether a pet in desperate
straits will eat a corpse that will cause it to polymorph used bad
logic.  The suspect code was added post-3.6.

Fixes #879

2 years agoupdate tested versions of Visual Studio 2022-09-21
nhmall [Wed, 21 Sep 2022 18:55:34 +0000 (14:55 -0400)]
update tested versions of Visual Studio 2022-09-21

2 years agoFix: starving herbivore pet vs polymorphing corpse
Michael Meyer [Tue, 20 Sep 2022 01:59:34 +0000 (21:59 -0400)]
Fix: starving herbivore pet vs polymorphing corpse

The special handling of polymorphing corpses included an "is acceptable
food if starving" rule which ignored the pet's other food preferences,
so a starving herbivorous pet would become willing to eat a
non-vegetarian corpse iff the corpse would polymorph it when eaten.
Along the same lines but latent: if there were a vegan polymorphing
corpse, a carnivorous pet would eat it not only if starving, but also if
maltreated and on the verge of becoming feral.

Instead of trying to fix this by reimplementing all the herbi vs carni
rules specifically for polymorphing corpses, just have a "don't eat
polymorphing corpses if neither starving nor almost untame" rule, and
fall back to the normal palatable corpses tests once it's been
determined that the pet is willing to eat even a polymorphing corpse.

I rephrased the comment just to make it negative (about avoiding
polymorph, rather than polymorph being OK under certain circumstances)
to match the new form of the rule.

2 years agogithub PR #858 - feedback when poly'd hero engulfs
PatR [Tue, 20 Sep 2022 23:59:43 +0000 (16:59 -0700)]
github PR #858 - feedback when poly'd hero engulfs

Pull request from entrez:  the change to remove digestion damage
from trappers and lurkers above didn't handle engulfing by poly'd
hero adequately.

Fixes #858

2 years agoDescribe engulf attacks a bit more consistently
Michael Meyer [Wed, 24 Aug 2022 17:08:46 +0000 (13:08 -0400)]
Describe engulf attacks a bit more consistently

Use verbiage for mon vs mon and hero (mostly hero) engulf attacks that
matches recent changes to monster vs hero engulf attacks more closely
(e.g. "swallows whole" instead of "engulfs" for purple worm, other
changes in b07fe59...).  Also ensure non-AD_DGST engulf attacks
(e.g. from revamped trapper or lurker above polyforms) aren't treated as
"eating" (or as involving "debris").

Also change the enfolds and digests macros so they produce booleans
rather than attack pointers (I got a compiler warning about casting
struct attack * to boolean when I did 'boolean b = digests(ptr);').

2 years agofixes entry and tweaks for PR #871 - revive corpse
PatR [Tue, 20 Sep 2022 21:33:39 +0000 (14:33 -0700)]
fixes entry and tweaks for PR #871 - revive corpse

Pull requet from entrez:  give better feedback than "it" when hero
observes a corpse reviving into a monster that can't be seen.

Tweak reviving from a container which was coded as if the container
was optional.  That can lead to confusion when someone reads the
code so make the situation more explicit.

Fixes #871

2 years agoImprove description of invisible mon revival
Michael Meyer [Sat, 10 Sep 2022 03:07:57 +0000 (23:07 -0400)]
Improve description of invisible mon revival

An invisible monster reviving would be called "it" (as in, "It rises
from the dead!").  Improve on this a bit by instead saying that "the
troll corpse disappears!" (similar to the messaging used when undead
turning is used on an invisible monster's corpse), or calling the
revived monster "something" (as in "something escapes from a sack!")
instead of "it".  Distinguish between the original location of the
corpse and the location of the revived monster when describing seeing
things that have happened to the corpse, since revival may not place it
on the corpse's location.

2 years agogithub #877 - fix "disintegration resistance"
PatR [Tue, 20 Sep 2022 20:24:54 +0000 (13:24 -0700)]
github #877 - fix "disintegration resistance"

Pull requet from vultur-cadens:  use space instead of hyphen in
enlightenment and end-of-game feedback.

All the other resistances already use space.  The inappropriate
hyphen in "disintegration-resistance" seems to have been present
since enlightenment was added (in 3.0; back then the relevant code
was in cmd.c; current insight.c didn't exist until 3.6).

Fixes #877

2 years agoUse a space instead of a hyphen in "disintegration-resistant"
vultur-cadens [Sat, 17 Sep 2022 06:40:56 +0000 (23:40 -0700)]
Use a space instead of a hyphen in "disintegration-resistant"

This is for consistency with the other resistance insight messages,
which use spaces instead of hyphens.

2 years agoPrevent trapdoors and holes dropping you into Sanctum
Pasi Kallinen [Tue, 20 Sep 2022 09:07:33 +0000 (12:07 +0300)]
Prevent trapdoors and holes dropping you into Sanctum

2 years agofixes entry for PR #876 - shop impossible \
PatR [Tue, 20 Sep 2022 02:01:35 +0000 (19:01 -0700)]
fixes entry for PR #876 - shop impossible \

when splitting a stack of named, shop-owned objects

Pull request from entrez:  when perm_invent is on, splitting an unpaid
stack would issue impossible "unpaid_cost: object wasn't on any bill"
while cloning the new stack's name from the old stack.

Fixes #876

2 years agoFix: impossible from splitting named stack on bill
Michael Meyer [Sat, 17 Sep 2022 02:50:39 +0000 (22:50 -0400)]
Fix: impossible from splitting named stack on bill

Trying to split an unpaid stack of named items in a shop, with
perm_invent enabled, would cause an impossible 'unpaid_cost: object
wasn't on any bill' because copy_oextra -> oname triggered an inventory
update while the newly created split stack was marked unpaid but before
the billing information had been split to match.  Defer the copy_oextra
call until the billing info has already been split.

2 years agoremove unused math.h in isaac64.c
nhmall [Mon, 19 Sep 2022 21:32:42 +0000 (17:32 -0400)]
remove unused math.h in isaac64.c

Close  #878

2 years agounix Makefile.src and hints
PatR [Sun, 18 Sep 2022 21:25:33 +0000 (14:25 -0700)]
unix Makefile.src and hints

Change the handling for windowing system specific files so that
when building for more than one set, each gets compiled as a set
instead of some being interspersed among rival window systems.
Put differently, handle tile.o specially so that there's no need
for the hints to sort the WINOBJ list in order to avoid tile.o
duplication.

So the order of compilation is
  common source files
  unix-specific files
  tty files
  curses files
  X11 files
  Qt files
  tile.c (if applicable), version.c, date.c

Previously, some of the X11 files were scattered around among the
others because of the spelling of their file names.

Only matters if you're watching the progress of a build.

2 years agoKnockback requires solid physical hit
Pasi Kallinen [Sun, 18 Sep 2022 14:56:01 +0000 (17:56 +0300)]
Knockback requires solid physical hit

Exclude unsolid monsters - air, water, and fire elementals.

2 years agoThemerooms: Engraving hints the location of buried treasure
Pasi Kallinen [Sun, 18 Sep 2022 09:35:30 +0000 (12:35 +0300)]
Themerooms: Engraving hints the location of buried treasure

Add two new themeroom functions that are called when generating
the level: pre_themerooms_generate and post_themerooms_generate,
calles before and after themerooms_generate.

Allow the buried treasure -themeroom to put down an engraving
anywhere on the level, hinting at the location of the treasure.

des.object contents function now gets the generated object passed
to it as a parameter.

2 years agoavoid a format-overflow warning
nhmall [Sat, 17 Sep 2022 23:29:09 +0000 (19:29 -0400)]
avoid a format-overflow warning

options.c: In function â€˜option_help’:
options.c:8820:55: warning: â€˜%s’ directive writing up to 255 bytes into a region of size 220 [-Wformat-overflow=]
 8820 |     Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
      |                                                       ^~   ~~~~~~~~~~

2 years agoRevert "NEED_VARARGS bit for end.c and files.c"
nhmall [Sat, 17 Sep 2022 19:58:05 +0000 (15:58 -0400)]
Revert "NEED_VARARGS bit for end.c and files.c"

This reverts commit af71163d99ab914c51ec3e3789cd4fb4f3f78c1f.

2 years agoRevert "NEED_VARARGS followup"
nhmall [Sat, 17 Sep 2022 19:57:52 +0000 (15:57 -0400)]
Revert "NEED_VARARGS followup"

This reverts commit 4d34e153e06b9d38588f0e856f5728ff8285df00.

2 years agoRevert "paste fix"
nhmall [Sat, 17 Sep 2022 19:57:31 +0000 (15:57 -0400)]
Revert "paste fix"

This reverts commit d1750e4abed25c0f34ecbca443a8cef46daf3605.

2 years agopaste fix
nhmall [Sat, 17 Sep 2022 18:48:02 +0000 (14:48 -0400)]
paste fix

2 years agoNEED_VARARGS followup
nhmall [Sat, 17 Sep 2022 18:22:20 +0000 (14:22 -0400)]
NEED_VARARGS followup

2 years agoNEED_VARARGS bit for end.c and files.c
nhmall [Sat, 17 Sep 2022 16:31:26 +0000 (12:31 -0400)]
NEED_VARARGS bit for end.c and files.c

avoid build failure in the event that NEED_VARARGS is already defined
on the compiler command line.

2 years agoRevert "onefile: isaac64.c <math.h> vs yn()"
PatR [Sat, 17 Sep 2022 00:45:31 +0000 (17:45 -0700)]
Revert "onefile: isaac64.c <math.h> vs yn()"

This reverts commit 94945a719afc0aa08eaff9aa1e0e2fbf159bf388.
It was too intrusive and can be handled by the 'onefile' script
by compiling isaac64.c before any source file that includes hack.h.

2 years agoinsults
PatR [Fri, 16 Sep 2022 23:38:44 +0000 (16:38 -0700)]
insults

random_insult[] and random_malediction[] are only used in wizard.c
so make them file-scope static instead of global.

2 years agofix issue #875 - contnr-to-contnr tip explosion
PatR [Fri, 16 Sep 2022 23:14:20 +0000 (16:14 -0700)]
fix issue #875 - contnr-to-contnr tip explosion

Issue reported by k2:  tipping a wand of cancellation, bag of
holding, or bag of tricks from a non-magic container into a bag of
holding causes the bag of holding to explode but it wasn't dealing
out explosion damage nor being logged for livelog/chronicle the way
putting the item directly into a bag of holding is handled.

This fixes the described issues but bones handling leaves a lot to
be desired.

Fixes #875

2 years agotradstdc.h, USE_STDARG
PatR [Fri, 16 Sep 2022 22:02:23 +0000 (15:02 -0700)]
tradstdc.h, USE_STDARG

Make USE_STDARG explicitly the default (it was implicitly the default
when NHSTDC is defined) and update some comments related to VA_DECL.

2 years agoPrevent impossible lighting a massive stack of candles
Pasi Kallinen [Fri, 16 Sep 2022 16:55:49 +0000 (19:55 +0300)]
Prevent impossible lighting a massive stack of candles

2 years agomore inconsistencies
nhmall [Fri, 16 Sep 2022 14:44:39 +0000 (10:44 -0400)]
more inconsistencies

2 years agomodernize added old-style function declarator
nhmall [Fri, 16 Sep 2022 04:55:08 +0000 (00:55 -0400)]
modernize added old-style function declarator

2 years agofix issue #843 - vampire revival sequencing
PatR [Fri, 16 Sep 2022 01:02:07 +0000 (18:02 -0700)]
fix issue #843 - vampire revival sequencing

Reported by Umbire:
|You kill SpaceMannSpiff!  SpaceMannSpiff puts on a dwarvish cloak.
|SpaceMannSpiff puts on a dwarvish iron helm.
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.

This was tough to reproduce but I finally managed it.  The issue
text mentions that it was fixed by copperwater in xNetHack with
commit 8c4af50f0aa3e72522f3eb98df039ff25c2a1ea0 to the repository
for that variant.  My attempt to cherry-pick that failed--I'm not
even sure whether it should have been expected to work--and some of
the code has been impinged upon by changes, so I ended up applying
the contents of that commit manually.

The commit changes how/when monsters put on new armor rather than
anything directly related to vampires.  Circumstances similar to
the example above now yield:
|You kill SpaceMannSpiff!
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.
on one turn, then on the next turn the revived vampire produces:
|SpaceMannSpiff puts on a dwarvish cloak.

My test case only had one item of interest; I assume that the second
item of armor gets worn on a subsequent turn rather than at the same
time as the first one.

Fixes #843

2 years agoobj.h mixup
PatR [Thu, 15 Sep 2022 21:17:43 +0000 (14:17 -0700)]
obj.h mixup

\#if 0 should have been #if 1.  Swap #then and #else instead.

2 years agoempty horn of plenty
PatR [Thu, 15 Sep 2022 21:14:12 +0000 (14:14 -0700)]
empty horn of plenty

Format a horn of plenty whose charge count is unknown but is known to
be empty as "empty horn of plenty" like is done for real containers.

This was too easy; I must have missed something....

2 years agomore #tip, mostly container-to-container
PatR [Thu, 15 Sep 2022 19:30:44 +0000 (12:30 -0700)]
more #tip, mostly container-to-container

Require a free hand when tipping a container into another container.
Presumeably you need to open the destination container and possibly
keep holding it open.

If you try to tip a carried container into an unknown bag of tricks,
apply the bag (once) instead of performing the tip.  (To 'open' the
destination as above.)  Possibly slightly confusing if bag is empty.

When tipping a container, always ask for the destination instead of
doing that only when carrying other containers.  Confirming floor
as destination can be annoying but having to do that sometimes and
skipping that sometimes is aggravating because it is error prone.
And floor is preselected so can be chosen with space or return.
(I wanted to change the selector letter for floor from '-' to '.'
and then keep '-' as an unseen group accelerator, but the latter
doesn't work for PICK_ONE so I've left '-' as-is.)

Don't display "monsters appear" after tipping a bag of tricks.
Monster creation gives feedback these days.  (Comparable to recent
"summon nasties" fix.)

2 years agoFix CI warning
Pasi Kallinen [Thu, 15 Sep 2022 15:55:15 +0000 (18:55 +0300)]
Fix CI warning

2 years agoSplit themeroom shape from themeroom contents
Pasi Kallinen [Thu, 15 Sep 2022 15:08:32 +0000 (18:08 +0300)]
Split themeroom shape from themeroom contents

Previously, the tetris-shaped rooms were always either
normal rooms, or turned into shops or other special rooms
in NetHack core. Now, the themed room lua code first picks
the themed room (which can be a themed or shaped), and some
of those will then pick a random filling (eg. ice floor,
traps, corpses, 3 altars).

Adds a new lua binding to create a selection picking locations
in current room.

The content-function in special level regions now get passed
the room data as a parameter.

2 years agoa couple of inconsistencies
nhmall [Thu, 15 Sep 2022 00:23:48 +0000 (20:23 -0400)]
a couple of inconsistencies

make pmatchregex regex_error_desc return type match cppregex.cpp and
posixregex.c

make the extern declaration for loadsyms[] in options.c match the
one in symbols.c.

2 years agohorn_of_plenty-to-container #tip
PatR [Wed, 14 Sep 2022 22:54:24 +0000 (15:54 -0700)]
horn_of_plenty-to-container #tip

For tipping purposes, a horn of plenty is treated like a container.
But using one as the source container in a container-to-container tip
wasn't supported.  Implement that.

Also, #tip was offering carried bags of tricks as candidate containers
to tip some other carried container into.  Only do that for ones which
aren't known to be bags of tricks (so when type not discovered yet, or
specific bag not seen yet due to blindness).

2 years agoMerge branch 'pr873' into NetHack-3.7
nhmall [Wed, 14 Sep 2022 03:06:52 +0000 (23:06 -0400)]
Merge branch 'pr873' into NetHack-3.7

2 years agoMerge branch 'vga-fixes' of https://github.com/chasonr/NetHack into pr873
nhmall [Wed, 14 Sep 2022 03:05:59 +0000 (23:05 -0400)]
Merge branch 'vga-fixes' of https://github.com/chasonr/NetHack into pr873

2 years agoSundry fixes for DOS 16-color VGA mode
Ray Chason [Tue, 13 Sep 2022 23:49:56 +0000 (19:49 -0400)]
Sundry fixes for DOS 16-color VGA mode

To test 16-color mode, specify OPTIONS=video:vga explicitly;
autodetect will choose a VESA mode if it can.

* Draw tiles correctly when redrawing from panning or from changing
  the map mode among text, tiles and overview. Previously, this would
  draw everything with the tile at the hero's position.

* Draw corridor walls with the stone tile.

* Map the statue colors to the nearest neutral tone among the main
  16 colors. This mainly affects altars and female cats.

* Fix the code that shows statues as the generic statue tile. This
  code could be deleted, but the statues don't draw with the full
  range of gray tones.

* Document the option OPTIONS=video:vesa.

2 years agoonefile: isaac64.c <math.h> vs yn()
PatR [Tue, 13 Sep 2022 20:59:24 +0000 (13:59 -0700)]
onefile: isaac64.c <math.h> vs yn()

isaac64.c includes <math.h>.  yn() is a non-STDC math function in
<math.h> and that conflicts with nethack's yn() macro or vice versa.

If other source files begin using <math.h> this will probably need
to be handled differently.

2 years agoonefile: 'here'
PatR [Tue, 13 Sep 2022 17:52:15 +0000 (10:52 -0700)]
onefile: 'here'

extralev.c's 'here' macro was interferring with subsequent uses of
'here' in code from other files.

2 years agoforward declarations for struct monst, struct obj
PatR [Tue, 13 Sep 2022 17:27:53 +0000 (10:27 -0700)]
forward declarations for struct monst, struct obj

This should eliminate the 'onefile' complaint for objects.c without
breaking anything with any standard conforming compiler.  (Fingers
crossed.)

2 years agocontainer-to-container #tip typo
PatR [Tue, 13 Sep 2022 11:28:49 +0000 (04:28 -0700)]
container-to-container #tip typo

When tipping a magic-bag exploder from a sack or box into a bag of
holding, the choice of whether to call useup() or useupf() was
backwards.  But nothing bad happened which is fishy.

2 years agoAllow suppressing debugfuzzer warnings
Pasi Kallinen [Tue, 13 Sep 2022 10:41:27 +0000 (13:41 +0300)]
Allow suppressing debugfuzzer warnings

2 years agofix issue #872 - container-to-container #tip
PatR [Mon, 12 Sep 2022 21:17:22 +0000 (14:17 -0700)]
fix issue #872 - container-to-container #tip

Reported by k2:  tipping one container's contents directly into
another container allowed transferring a wand of cancellation (not
mentioned:  or a bag of holding or a bag of tricks) into a bag of
holding without blowing it up.

That's now fixed.  There are other issues that this doesn't touch:

I think it's odd that you can transfer stuff from one carried
container to another but not from a carried container to a floor
container nor from one floor container to another one at same spot.

I didn't test shop billing so an not sure what happens when #tip
blows up a bag of holding and there are some unpaid items involved.

Using #tip on horn of plenty treats it like a container, but doing
that when it's carried doesn't offer the chance to tip its contents
directly into a carried container.

Tipping a carried container does not require free hands or even
limbs (for playability) but tipping such into another container
should require at least one free hand.

Fixes #872

2 years agoMacOS msdos compiler fetch script bit
nhmall [Sun, 11 Sep 2022 23:33:56 +0000 (19:33 -0400)]
MacOS msdos compiler fetch script bit

2 years agofix an options.c FIXME
PatR [Sun, 11 Sep 2022 20:15:39 +0000 (13:15 -0700)]
fix an options.c FIXME

Renaming got_from_config[] (something that was done in the past)
to set_in_config[] (something to do in the future) is sufficient to
remove any confusion about why it is being set from 'O'.  Since that
is the name of an enum value, use opt_set_in_config[] instead.

2 years agoMore damageum return values
Pasi Kallinen [Sun, 11 Sep 2022 18:52:46 +0000 (21:52 +0300)]
More damageum return values

2 years agoUse define in damageum return value check
Pasi Kallinen [Sun, 11 Sep 2022 18:30:54 +0000 (21:30 +0300)]
Use define in damageum return value check

2 years agocomment and declaration is outdated
nhmall [Sun, 11 Sep 2022 13:08:35 +0000 (09:08 -0400)]
comment and declaration is outdated

It looks like quite a lot of time has passed since this was accurate.

2 years agoenc_stat[], hu_stat[]
PatR [Sun, 11 Sep 2022 02:30:36 +0000 (19:30 -0700)]
enc_stat[], hu_stat[]

The definition of enc_stat[] got changed by a pull request nearly a
year ago ('const char *enc_stat[]' -> 'const char *const enc_stat[]')
but the separate declarations for it weren't changed to match.

Make the same change for hu_stat[].  Not sure why the pull request
didn't include it since the old declaration and the usage are same.

The curses one is in code that isn't used.

2 years agofix #H3820 - vault guard's "I repeat" message
PatR [Fri, 9 Sep 2022 18:45:30 +0000 (11:45 -0700)]
fix #H3820 - vault guard's "I repeat" message

Reported seven and a half years ago:  if you are in a vault but not
carrying any gold and the guard arrives, you're told "Follow me."
Then if you pick up gold while the guard is still in the wall breach
rather than out in the corridor, you would be told "I repeat, drop
that gold and follow me!"  "Repeat" refers to the follow part but
sounds as if it refers to the drop-gold part which isn't actually
being repeated.  Keep track of whether the guard has issued a drop
gold demand and use that to vary the wording of subsequent "I repeat"
message.

Modifies monst->mextra->egd so save and bones files are invalidated.

2 years agoRemove the per dungeon level door limit
Pasi Kallinen [Fri, 9 Sep 2022 09:58:45 +0000 (12:58 +0300)]
Remove the per dungeon level door limit

Number of doors in a room-and-corridor style level was fixed
at 120; now the doors-array is dynamically allocated when needed.

Breaks saves and bones.

2 years agoGuidebook update
nhmall [Fri, 9 Sep 2022 14:16:45 +0000 (10:16 -0400)]
Guidebook update

2 years agoFix traps generated inside walls
Pasi Kallinen [Fri, 9 Sep 2022 09:03:08 +0000 (12:03 +0300)]
Fix traps generated inside walls

When fuzzing, noticed a trap generated inside a wall. Culprit
was one of the themed rooms that generates a rectangular room and then
puts freestanding wall columns inside.  Note in somexy that it can
return a non-accessible location, and change the places that used
it and absolutely needed a space to somexyspace.

2 years agodoset_simple() revisited
PatR [Thu, 8 Sep 2022 23:26:31 +0000 (16:26 -0700)]
doset_simple() revisited

For a compound option's value that uses getlin(), cancelling with
ESC wasn't dismissing the menu and could eventually result in a
"No window slots!" panic.  Clean up properly after ESC.

doset() and doset_simple() were sharing a format string but those
weren't the same if the longest option name differed.  Stop sharing.

doset_simple() didn't support menu_tab_sep.  Now it does.  (Tested
with Qt; really needs to be tested with WinGUI.  Enabling that is
expected to produce strange looking results with tty or curses.)

2 years agoa couple of warnings in files.c
nhmall [Thu, 8 Sep 2022 16:31:36 +0000 (12:31 -0400)]
a couple of warnings in files.c

Warning C6031 Return value ignored: 'rename'. src/files.c 1240
Warning C6031 Return value ignored: 'write'. src/files.c 3879

2 years agoPasses_walls
PatR [Thu, 8 Sep 2022 16:18:43 +0000 (09:18 -0700)]
Passes_walls

While testing the secret door message handling, I wanted to phaze
through solid rock to get near some secret corridors.  Instead of
polymorphing into a xorn, I used #wizintrinsic to get temporary pass
through walls.  That let me move orthogonally through rock but not
diagonally.  Polymorph to xorn did allow diagonal movement.  I think
the difference was gaining 18/100 strength in that form.

Have wall phazing override narrow diagonal checks.

2 years agofix a grammar bit adjacent to recent spelling fix
nhmall [Thu, 8 Sep 2022 16:08:37 +0000 (12:08 -0400)]
fix a grammar bit adjacent to recent spelling fix

2 years agosecret door detection feedback
PatR [Thu, 8 Sep 2022 15:53:02 +0000 (08:53 -0700)]
secret door detection feedback

When zapping a wand of secret door detection or casting spell of
detect unseem instead of displaying
|You reveal secret doors.
|You reveal a secret corridor.
|You reveal traps.
|You reveal a hidden monster.
show
|You reveal 2 secret doors, a secret corridor, 3 traps, and a hidden monster.
as a single message.

Detecting invisible monsters is still a separate message; those get
re-mapped as "remembered, unseen monster" but not actually revealed.

2 years agosome spelling corrections
nhmall [Thu, 8 Sep 2022 14:54:11 +0000 (10:54 -0400)]
some spelling corrections

The pull request included some changes that were neither accidental nor
unintentional, so only a subset of the changes from pull request #869
submitted by klorpa were manually applied.

behaviour  -> behavior
speach     -> speech
knowlege   -> knowledge
incrments  -> increments
stethscope -> stethoscope
staiway    -> stairway
arifact    -> artifact
extracing  -> extracting

The uses of "iff" were left alone.

Close #869

2 years agoDocument italic for menu headings and menu colors
Patric Mueller [Thu, 8 Sep 2022 10:39:02 +0000 (12:39 +0200)]
Document italic for menu headings and menu colors

2 years agoroom stocking would put multiple items on the same spot
Patric Mueller [Thu, 8 Sep 2022 07:23:57 +0000 (09:23 +0200)]
room stocking would put multiple items on the same spot

2 years agodoset_simple()
PatR [Wed, 7 Sep 2022 21:37:08 +0000 (14:37 -0700)]
doset_simple()

Move the guts of doset_simple() into a separate routine.  Initially
that was just to avoid having to increase indentation when replacing
'goto' with 'do { ... } until ()'.  It ends up making the flow of
control easier to see.

doset() and doset_simple() each had their own static flag indicating
whether 'fmtstr_doset' had been assigned a value.  Redundant
assignment produced the same value so it wasn't an actual problem.

doset_simple() probably needs to add menu_tab_sep support for WinGUI.
Qt is able to get by without it, but that's because it forces use of
fixed-width font when any line in a menu or text window has 4 or more
consecutive spaces.  I don't think WinGUI does that.

2 years agoredundant comparison code watchman_canseeu()
nhmall [Wed, 7 Sep 2022 11:52:33 +0000 (07:52 -0400)]
redundant comparison code watchman_canseeu()

m_canseeu() already includes couldsee() so redundant code was flagged.

: #define m_canseeu(m) \
:     ((!Invis || perceives((m)->data))                      \
:      && !Underwater                                        \
:      && couldsee((m)->mx, (m)->my))

static boolean
watchman_canseeu(struct monst *mtmp)
{
    if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp)
        && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful)
        return TRUE;
    return FALSE;
}

2 years agoAdd #wizcast command to cast any spell
Pasi Kallinen [Tue, 6 Sep 2022 19:49:43 +0000 (22:49 +0300)]
Add #wizcast command to cast any spell

Wizard-mode command to cast any spell without checks that would
prevent casting, and with no energy use.

Mainly to allow the fuzzer to exercise the spell code paths.

2 years agofollow-up
nhmall [Tue, 6 Sep 2022 14:12:19 +0000 (10:12 -0400)]
follow-up

2 years agoreturn legal indexes for some display.h macros
nhmall [Tue, 6 Sep 2022 14:00:07 +0000 (10:00 -0400)]
return legal indexes for some display.h macros

Some static analyzers flagged the last-resort values as
out of bounds (which they were).

There's a small number of other complaint-suppression items in here too,
but nothing drastic.

2 years agoRevert "move struct propname to a header file"
nhmall [Tue, 6 Sep 2022 12:01:50 +0000 (08:01 -0400)]
Revert "move struct propname to a header file"

This reverts commit 402b2bf5c864c04a673658d6ad9bed159b581ca6.

2 years agomove struct propname to a header file
nhmall [Tue, 6 Sep 2022 11:22:55 +0000 (07:22 -0400)]
move struct propname to a header file

In doing so, avoid repeated layout declaration in cmd.c

2 years ago\#herecmdmenu tweak
PatR [Mon, 5 Sep 2022 21:58:55 +0000 (14:58 -0700)]
\#herecmdmenu tweak

The menu for #herecmdmenu includes "look at map symbol" but if you
choose that it auto-picks the hero's location.  Looking at your own
'@' isn't particularly useful so only include that menu option if
the symbol or tile being displayed isn't the normal one.

2 years agocurses A_ITALIC build fix
PatR [Mon, 5 Sep 2022 21:40:41 +0000 (14:40 -0700)]
curses A_ITALIC build fix

My /usr/include/curses.h has various A_attribute macros but A_ITALIC
isn't one of them.  Compiling cursmisc.c failed because one of the
uses of that wasn't guarded by #ifdef A_ITALIC.  Instead of adding the
ommitted #if, substitute A_UNDERLINE for A_ITALIC when that's missing.

The select attribute menu when adding a menu color or a status hilite
now shows an entry for italic that's underlined (as expected) but the
underline entry itself does not display any sort of attribute.  I
didn't pursue that.