]> granicus.if.org Git - nethack/log
nethack
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.

2 years agoAdd tipping a container to herecmdmenu
Pasi Kallinen [Mon, 5 Sep 2022 20:27:58 +0000 (23:27 +0300)]
Add tipping a container to herecmdmenu

2 years agoredundant comparison code
nhmall [Mon, 5 Sep 2022 15:16:43 +0000 (11:16 -0400)]
redundant comparison code

: #define is_weptool(o) \
:    ((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE)

2 years agoCannot kick while squeezed on top of a boulder
Pasi Kallinen [Mon, 5 Sep 2022 08:21:19 +0000 (11:21 +0300)]
Cannot kick while squeezed on top of a boulder

2 years agotty and curses: support italic as text attribute
Patric Mueller [Sun, 4 Sep 2022 20:33:25 +0000 (22:33 +0200)]
tty and curses: support italic as text attribute

2 years agoMake glorkums emit impossible
Pasi Kallinen [Sun, 4 Sep 2022 14:43:01 +0000 (17:43 +0300)]
Make glorkums emit impossible

2 years agodiscarding migrating objects when entering endgame
PatR [Sat, 3 Sep 2022 17:45:24 +0000 (10:45 -0700)]
discarding migrating objects when entering endgame

Avoid potential impossible "obfree: deleting worn object" warnings
when entering the endgame.

The code to get rid of items migrating to non-endgame levels passes
those items to obfree().  It needs to clear obj->owornmask first
because that's used for migration flags (undelivered orctown loot
has a non-zero value).

2 years agoSpecial levels: mkmap roomno cleanup and room removal after map
Pasi Kallinen [Sat, 3 Sep 2022 16:10:41 +0000 (19:10 +0300)]
Special levels: mkmap roomno cleanup and room removal after map

mkmap creates mines-style full-level maps, so it should wipe
out all the room numbers in the level away. Also, it uses
temporary rooms for making sure the map is fully joined together;
those temporary rooms were left on the map, but should've
been cleared away.

When putting down map-parts on the level, don't remove the room
data which would be under that map; the map may have holes in them
(using the "x" map char), so a room may still exist there.
I don't think it matters if there is any room data which doesn't
have any room numbers referring to it in the level.
(Usually the special levels use map right after level_init anyway,
so there wouldn't be any rooms in the level)

2 years agotypo fix and comment update for #migratemons
PatR [Thu, 1 Sep 2022 20:36:50 +0000 (13:36 -0700)]
typo fix and comment update for #migratemons

2 years agoMake des.mineralize use default probabilities
copperwater [Thu, 1 Sep 2022 03:57:41 +0000 (23:57 -0400)]
Make des.mineralize use default probabilities

Calling des.mineralize() with no arguments was equivalent to calling it
and manually specifying gem_prob = 0, gold_prob = 0, etc. Which meant
that no mineralization would actually happen.

Instead, make this match the intuitive behavior, and pass in -1
probabilities as defaults -- which the mineralize() function interprets
as the caller wanting to use the standard probabilities for a level of
that depth, as if it were not a special level.

This change does not affect any special level files since des.mineralize
is not currently used in any of them.

2 years agoFix inaccessible spaces and shop backdoors in Bustling Town
copperwater [Wed, 31 Aug 2022 15:57:44 +0000 (11:57 -0400)]
Fix inaccessible spaces and shop backdoors in Bustling Town

Perennial problem: since Bustling Town consists of a fixed map which was
shorter than the moveable area overlaid onto a cavern fill, sometimes
the cavern fill made spaces above or below the walled edges of the town,
which then got cut off when the town was placed. Since one of the valid
ways to generate a way out of an inaccessible space is to create a door
connecting it to an accessible space, this meant rooms in Minetown,
including shops, could get a second door leading into that tiny space.
And if it was a shop, the shopkeeper could not block exit from the
second door.

This fixes that issue by expanding the map vertically so that it will
overwrite the whole cavern fill in the town area of the map segment
where it might create cut-off spaces like this. (Not the whole area -
since we now have the 'x' mapchar to leave existing terrain in place,
areas adjoining open space where inaccessible pockets won't get
created can retain any existing fill to keep the town from being exactly
the same every time).

2 years agoFixes entry
Pasi Kallinen [Thu, 1 Sep 2022 14:09:26 +0000 (17:09 +0300)]
Fixes entry

2 years agoUse const char * for read_simplemail 'mbox' param
Michael Meyer [Thu, 1 Sep 2022 01:42:02 +0000 (21:42 -0400)]
Use const char * for read_simplemail 'mbox' param

Nothing about read_simplemail is incompatible with using const, and the
lack of const required some contortions (copying ADMIN_SERVER_MSG to
another buffer with nonconst() to prevent a compiler warning).

This was the last place nonconst() was used, so I removed it.

2 years agoSome minor read_simplemail improvements
Michael Meyer [Tue, 30 Aug 2022 21:45:44 +0000 (17:45 -0400)]
Some minor read_simplemail improvements

Make admin message use urgent_pline so it's less likely to be skipped
and inadvertently missed, make ending punctuation conditional on message
itself not containing any (similar to what's done for T-shirt messages
in read.c), guard against printing an empty message (from a line like
"name:\n"; it does mean that subsequent messages in a single batch will
be discarded, but that's true of the existing guard against malformed
lines as well, and it should make the overwriting of characters past the
'msg' ptr safer).

2 years agomore summon nasties
PatR [Thu, 1 Sep 2022 00:23:55 +0000 (17:23 -0700)]
more summon nasties

If the summon nasties spell creates a single monster, the feedback
changes from "Monsters appear" to "A monster appears" but if you
were invisible or displaced it still said "around".  Avoid
| A monster appears around a spot near you!
or
| A monster appears around your displaced image!

2 years agosummon nasties feedback
PatR [Wed, 31 Aug 2022 23:34:56 +0000 (16:34 -0700)]
summon nasties feedback

Reported by entrez:  when a monster casts the "summon nasties" spell,
double feedback was given.  First it produced "a <monster> appears"
for each visible monster and then "<monsters> appear from nowhere" at
the end.  The latter would have been ok at the begining but made it
seem as if even more monsters were arriving when given at the end.

Skip the monster-by-monster feedback and just give the summary at the
end.  That's enough information for a blind player to know to check
the map for new monsters.

When summon nasties is performed as randomly chosen harassment after
killing the Wizard, it still gives the enumerated "a <monster> appears"
feedback but does not give the "from nowhere" message at the end.

2 years agofake player creation on Astral
PatR [Wed, 31 Aug 2022 20:04:54 +0000 (13:04 -0700)]
fake player creation on Astral

Reported by entrez:  fake player monsters on the Astral Plane level
were giving "<role> suddenly appears!" feedback if they could be
seen or sensed when the hero arrived on that level.

They're generated separately from the level itself so the message
suppression in place during level creation didn't guard against it.

2 years agoStandardize all core and obj functions with relative coords
copperwater [Tue, 30 Aug 2022 22:07:07 +0000 (18:07 -0400)]
Standardize all core and obj functions with relative coords

This is a large iteration on a previous implementation of making
nh.getmap() parse its coordinates as relative to the last defined map or
room rather than absolute to the entire level. Now, everything in the
nh.* and obj.* functions interprets coords as relative rather than
absolute. (By default; if no map or room has been defined, or if the lua
code is executing after level creation is done, they will interpret the
coordinates as absolute).

The general motivation is basically the same - routines that use
absolute coordinates are difficult to use in level creation routines,
because then the designer has to remember to convert the relative
coordinate to an absolute one (and that was impossible before
nh.abscoord was added, particularly in themed rooms). And once
nh.getmap() takes relative coordinates, it would be very strange to have
all the other functions (setting timers, burying objects, etc) remain
with absolute ones.

In a couple places, code is changed to account for coordinates that are
relative to a *room* (which uses g.coder->croom->[lx,ly] as an offset,
instead of relative to a *map*, which uses [xstart,ystart].
Specifically, selection.iterate did not account for this, and without
this the ice themed room timer was not being started in the proper
place.

All tests are updated to respect the new behavior. Most of the modified
functions are not actually used anywhere in level files; the one
exception is starting a timer in a themed room, and that has been
adjusted.

Documentation updated as well to clarify when various things are tossing
around relative and absolute coordinates, both in comments and in
lua.adoc.

2 years agonh.getmap() returns information relative to the most recent des.map
copperwater [Wed, 23 Mar 2022 01:13:51 +0000 (21:13 -0400)]
nh.getmap() returns information relative to the most recent des.map

There are many possible use cases for nh.getmap during level creation,
but it's rendered mostly unusable by virtue of always returning data
about the exact x,y coordinate in g.level.locations. (In particular,
it can't currently be used in themed rooms at all, because the themed
room could be anywhere on the level.) This is inconsistent with how most
other coordinate-based functions work following a des.map, which use
coordinates relative to the 0,0 point of the map.

This changes it so that during level creation only, if nh.getmap is used
following a des.map statement, it will look up the coordinates relative
to the origin of the map, consistent with the other functions.

2 years agoFix: overwriting stairs in movement tests
Michael Meyer [Fri, 26 Aug 2022 17:15:00 +0000 (13:15 -0400)]
Fix: overwriting stairs in movement tests

Like some of the other coordinates in testmove.lua (addressed in
70008fc), the attempt to overwrite the stairs was targeting a spot
one space to the left of the actual position of the stairs, causing it
to have no effect (discussion suggested this may have been a result of
99715e0).  Update it so the stairs are properly erased and won't
interfere with movement tests by stopping a running/rushing hero early.

2 years agofix the tty message spacing anomaly for messages \
PatR [Tue, 30 Aug 2022 22:01:49 +0000 (15:01 -0700)]
fix the tty message spacing anomaly for messages \

delivered across level change checkpointing

Reported by entrez.  Simplest test case:  give level 1 a short
annotatation, level teleport to level 2, and level teleport back to
level 1.  The message window will show

|You materialize on another level.  You remember this level as <note>.

but ^P message history will show

|You materialize on another level.
|  You remember this level as <note>.

Spaces inserted to separate two messages that fit together on the
top line become part of the second message when saving a checkpoint
during level change flushes the top line into message history.

Change insurance checkpointing to record the full message history
without flushing the current top line so that toggling 'checkpoint'
doesn't affect what shows up on the screen or in message recall.

2 years agodecl.c warnings
PatR [Tue, 30 Aug 2022 21:56:40 +0000 (14:56 -0700)]
decl.c warnings

Fix a bunch of "suggest braces around initialization of subobject"
warnings from clang.  If gcc didn't warn about these before, it might
start complaining about too many braces now.

It doesn't attempt to do anything about missing field initializers
because I'm not seeing any warnings for those.

2 years agofollow-up
nhmall [Mon, 29 Aug 2022 18:35:39 +0000 (14:35 -0400)]
follow-up

Revert the sys/unix/hints/include/compiler.370 for now
while a couple of warnings still exist in role.c

2 years agowarning-free build without -Wno-missing-field-initializers
nhmall [Mon, 29 Aug 2022 18:06:12 +0000 (14:06 -0400)]
warning-free build without -Wno-missing-field-initializers

Also removes a GCC_WARN usage and the need for
#pragma GCC diagnostic ignored "-Wmissing-braces"
for src/decl.c when using gcc.

2 years agolev_by_name() formatting bits
PatR [Sun, 28 Aug 2022 23:57:42 +0000 (16:57 -0700)]
lev_by_name() formatting bits

Formatting became strange when '#ifdef WIZARD' became unconditional
several years ago, then the bitmask testing code itself became a bit
strange when amnesia got changed a couple of years ago.

2 years agopull request #857 - levelport destination by name
PatR [Sun, 28 Aug 2022 22:35:58 +0000 (15:35 -0700)]
pull request #857 - levelport destination by name

Pull request from entrez:  specifying a level teleport destination
by level name allowed non-wizard mode controlled level teleport to
move across dungeon branchs.

Does not affect wizard mode '^V ?' or 'm ^V'.

Closes #857

2 years agoFix: levelport by name to unconnected branch
Michael Meyer [Fri, 19 Aug 2022 21:10:09 +0000 (17:10 -0400)]
Fix: levelport by name to unconnected branch

(unconnected to the current dungeon branch, that is)

Level teleporting allows you to type in the name of a level instead of
its number.  This normally only works for levels within your current
dungeon branch (main dungeon <-> Gehennom levelports are the exception):
entering "medusa" as a destination won't work while the hero is in the
Gnomish Mines, but it will work fine to get to the Medusa level from
elsewhere in the main dungeon.

Teleporting to a particular branch entrance didn't apply the same
restriction.  The teleport would still happen even if the destination
branch was unreachable from the current branch, and in such a case the
game would just try to get the hero to the depth of the branch entrance,
within the current branch.  For example, entering "quest" as a
destination within the Gnomish Mines would bring the hero to Mines' End,
since that's the closest depth-wise it's possible to get to the quest
portal level.  Apply the same rules to branch entrances as exist for
named levels, excluding destinations that are unreachable from the
current branch.

2 years agopull request #863 - chronicle disclosure
PatR [Sun, 28 Aug 2022 21:34:15 +0000 (14:34 -0700)]
pull request #863 - chronicle disclosure

Pull request from entrez:  move the 'Major events' listing (subset
of #chronicle output) later in final dumplog.

Closes #863

2 years agoMove 'major events' section in dumplog
Michael Meyer [Sun, 28 Aug 2022 15:06:53 +0000 (11:06 -0400)]
Move 'major events' section in dumplog

The sections of the dumplog can be broadly organized into two
categories: 'current state' and 'game overview'.  Current state includes
information about what exactly was happening when the game ended: the
map, recent messages, current inventory, and current attributes.  Game
overview is more like a history of the game up to that point: vanquished
monsters, extinct species, conducts, and dungeon overview.

All the current state sections are listed first, followed by the game
overview sections -- I'm not sure if this was a deliberate move to break
the dumplog into two distinct 'chapters', but it's convenient for
readers who may only want to know the circumstances of a death without
seeing the nitty-gritty details of the entire game up to that point.

The one section that wasn't ordered with its category was major events,
which was positioned near the top of the 'current state' group, above
the inventory listing.  This commit moves it into the 'game overview'
group.  I put it at the top, since it can serve as a sort of summary of
the game for those who are interested but don't care about some of the
details of monsters killed, etc.

2 years agofixes entry
Pasi Kallinen [Sun, 28 Aug 2022 15:48:01 +0000 (18:48 +0300)]
fixes entry

2 years agoEnhance feedback from detect unseen
copperwater [Sun, 28 Aug 2022 12:53:07 +0000 (08:53 -0400)]
Enhance feedback from detect unseen

I was never too happy with how this was a silent effect that required
you to watch the map to see if anything changed. It might count as
an accessibility issue as well, not sure.

This change adds specific feedback for all the possible things that
might get revealed by detecting unseen. If you reveal a secret door or a
trap, you now get a message indicating that.

One slight behavior change here: if the only thing detected is invisible
monsters, the game previously did not return a result of "detected
a non-zero number of things" to the caller of findit(); now it does.
(This allows the wand to be automatically identified when it prints a
message about detecting invisible monsters.)

2 years agoRemove "danger sense" message for a monster you can already see
copperwater [Sun, 28 Aug 2022 12:09:18 +0000 (08:09 -0400)]
Remove "danger sense" message for a monster you can already see

If you had both warning and ESP, you would get the message "Your danger
sense causes you to take a second look close by" when moving next to a
monster that is technically "undetected" (according to mundetected) but
was actually apparent to the player via ESP. For instance, moving next
to an eel hiding in the water would produce this.

Since there was no follow-up message ("You find a <monster>".) and no
new information being given to the player, the "danger sense" message
was pointless, and so I removed it in this case when the warning doesn't
lead you to find anything new.

2 years agoFix migrating monster throwing a potion
Pasi Kallinen [Sun, 28 Aug 2022 15:29:09 +0000 (18:29 +0300)]
Fix migrating monster throwing a potion

When a monster did something trying to get out of a boulder fort,
it usually meant teleporting or going down stairs or a hole.
The code didn't check for the action return value, and resulted
in a migrating monster being able to throw a potion at hero.

2 years agoFix hang when getting an input prompt
Pasi Kallinen [Sun, 28 Aug 2022 11:09:06 +0000 (14:09 +0300)]
Fix hang when getting an input prompt

When you were busy with an occupation, such as digging with
a pickaxe, and a prompt showed up to ask you enter something,
the game just hung with infinite loop.

Remove the occupation check returning a NUL from the input
function. I didn't notice any side effects, but I would not
be surprised if something comes up ...

I didn't investigate which commit caused this, but I suspect my
rhack or parse changes.

2 years agoUnix: command line --windowtype:foo fix
PatR [Sun, 28 Aug 2022 07:09:50 +0000 (00:09 -0700)]
Unix: command line --windowtype:foo fix

initoptions(), including initoptions_finish(), was running to
completion with the default window system before windowtype from the
command was parsed and activated.  When the default window system
is tty without MS-DOS the map type gets set to ascii; command line
--windowtype:X11 doesn't switch it back to the X11 default of tiled.

So,
| NETHACKOPTIONS=windowtype:X11 nethack
ran nethack in tiles mode but
| nethack --windowtype:X11
ran it in text mode (assuming .nethackrc left tiles vs text with the
default setting).

I think this fix is quite iffy but it seems to work as intended....
It reclassifies '--windowtype' as an "early option" in unixmain.c,
and the options.c code ultimately processes it twice.

2 years agolivelog/#chronicle for Sokoban completion
PatR [Sat, 27 Aug 2022 21:00:06 +0000 (14:00 -0700)]
livelog/#chronicle for Sokoban completion

Change "completed sokoban 3" to "completed 3rd Sokoban level".
It doesn't seem like much of an improvement.

2 years agofollow-up on display macro tests
nhmall [Sat, 27 Aug 2022 12:40:05 +0000 (08:40 -0400)]
follow-up on display macro tests

2 years agofix glyph_to_cmap() odd macro results
nhmall [Sat, 27 Aug 2022 12:23:24 +0000 (08:23 -0400)]
fix glyph_to_cmap() odd macro results

Some discrepencies between glyph_is_cmap and glyph_to_cmap
arose after b14b830b because the change resulted in
glyph_is_cmap matching on zap beams which weren't accounted
for in the glyph_to_cmap macro. It is unlikely that
glyph_to_cmap will ever be used on such a glyph, but at least
have glyph_to_cmap return a sane value rather than drop through
to the last-resort value (currently NO_GLYPH) which is far
outside the range of the defsyms[] array indices.

2 years ago'wizhelp' update
PatR [Sat, 27 Aug 2022 00:07:38 +0000 (17:07 -0700)]
'wizhelp' update

After I added '#migratemons' I realized that lots of other, mostly
obscure, wizard mode commands were missing.  Some of the descriptions
are vague because I'm not sure what several of them actually do.

2 years agolit candles generated by wishing could have wrong light radius
Patric Mueller [Fri, 26 Aug 2022 19:36:42 +0000 (21:36 +0200)]
lit candles generated by wishing could have wrong light radius

begin_burn() was called before the quantity of wished lit candles was
restricted which meant that the light source radius could depend on a
larger quantity than the final object actually had.

2 years agoRevert "fix some (not all) glyph_to_cmap odd ret"
nhmall [Fri, 26 Aug 2022 19:06:59 +0000 (15:06 -0400)]
Revert "fix some (not all) glyph_to_cmap odd ret"

This reverts commit bb4474bbaffec06fe1a59767f2694790025f016f.

2 years agoextraneous line
nhmall [Fri, 26 Aug 2022 18:25:09 +0000 (14:25 -0400)]
extraneous line

2 years agofix some (not all) glyph_to_cmap odd returns
nhmall [Fri, 26 Aug 2022 18:08:03 +0000 (14:08 -0400)]
fix some (not all) glyph_to_cmap odd returns

I think some of these discrepencies between glyph_is_cmap and
glyph_to_cmap started after b14b830b because the additional
ranges added by that didn't have a corresponding return in
glyph_to_cmap.

2 years agodebug code to check some display macros
nhmall [Fri, 26 Aug 2022 18:01:52 +0000 (14:01 -0400)]
debug code to check some display macros

2 years agoAdd makesingular to test_src
Michael Meyer [Tue, 2 Aug 2022 20:20:31 +0000 (16:20 -0400)]
Add makesingular to test_src

There are already pretty solid tests of makeplural, so add some in the
other direction, since it's similarly complicated and has to implement
many of the same special cases and exceptions in the other direction.  I
originally tried just running the makeplural tests backwards to this
end, but several of them are tests to guarantee already-plural words
aren't further pluralized, so are not reversible.

2 years agoFix: test_src -eaux plurals
Michael Meyer [Tue, 2 Aug 2022 19:50:16 +0000 (15:50 -0400)]
Fix: test_src -eaux plurals

These plurals (e.g. "gateau" -> "gateaux") were added to makeplural and
makesingular in 0c0262e, so the test was outdated and failed.  I also
added another test for "Federal Bureau of Investigation", since 'bureau'
is an exception to the -eau rule (pluralizes as 'bureaus') and the
exception was originally implemented in a way that would have caused the
"Federal Bureau of Investigation" test to fail -- so it seems like a
good pitfall to test for.

2 years agoFix: movement tests
Michael Meyer [Tue, 2 Aug 2022 19:39:49 +0000 (15:39 -0400)]
Fix: movement tests

Movement tests weren't working because terrain was being positioned one
square to the left of where it was expected, and the error message
printed something other than the expected coordinates.

I wasn't able to figure out why they were like this in the first place
(referring to one spot to the left of the hero with <u.ux-2, u.uy>), so
it's quite possible that I am missing some context here, but the test
failed consistently for me before making these changes, and now works.

2 years agoAllow lua test files to call error()
Michael Meyer [Tue, 2 Aug 2022 19:06:06 +0000 (15:06 -0400)]
Allow lua test files to call error()

Enable 'debugging' function calls, including error(), from the lua files
called by the wizard-mode #wizloadlua command.  Without enabling them,
calling error() still produces an error but with a message like
"attempt to call a nil value (global 'error')" instead of the one
specified in the lua file.

I think this is the right way to do this without just enabling
everything across the board (which I assume would contradict the goals
of NHL_SANDBOX), but I will admit to being a little confused by trying
to understand exactly how the sandbox permissions work, so it's possible
this isn't the right solution.

Incidentally, I am probably misunderstanding this, but considering a lua
error still occurs when error() is called, just with a different error
message, is the function really "disabled" successfully by NHL_SANDBOX?

2 years agoExpose selection bounds to lua
Pasi Kallinen [Fri, 26 Aug 2022 10:07:52 +0000 (13:07 +0300)]
Expose selection bounds to lua

2 years agoSome selection optimizations
Pasi Kallinen [Fri, 26 Aug 2022 09:31:25 +0000 (12:31 +0300)]
Some selection optimizations

- Add bounds, so that we don't process any locations outside
  as those locations are known to be unset
- The bounds are only recalculated if needed
- Replace instances of selection_not where we actually want
  a new selection with all locations set

2 years agogit issue #838 - old time manipulation for BSD
PatR [Fri, 26 Aug 2022 06:35:36 +0000 (23:35 -0700)]
git issue #838 - old time manipulation for BSD

Issue #838 from clausecker, relayed by copperwater:  old workarounds
for lack of type 'time_t' from pre-standard days aren't suitable any
more.  One of the instances was incorrect (diagnosed by entrez) and
no one had noticed for years (or possibly just ignored a compiler
warning).

Remove most of the old cruft from hacklib.c and some from system.h
but put in commented workarounds in unixconf.h in case someone needs
to resurrect it.  It would have been better to do things this way
back in the old days.

Resurrecting some non-Unix port might need to clone the unixconf.h
bits in its own *conf.h, but that probably won't be necessary for a
standard C compliant system.

Closes #838

2 years agomake #migratemons unconditional
PatR [Thu, 25 Aug 2022 17:36:47 +0000 (10:36 -0700)]
make #migratemons unconditional

Make #migratemons command be unconditional.  The show existing
ones part is now always present.  Compile-time DEBUG_MIGRATING_MONS
controls whether the create N new migrators part is available.

Fix creating new ones from the Castle level.  It knew how to find
the next level (Valley) but wouldn't send monsters there because of
its Is_botlevel() check.

2 years agoAdjust couple therecmdmenu entries
Pasi Kallinen [Thu, 25 Aug 2022 15:10:47 +0000 (18:10 +0300)]
Adjust couple therecmdmenu entries

- Don't show attacking a peaceful or tame monster, as
  that is actually swapping places with them - so add that.

- Don't show naming a hostile monster - it's usually not
  wanted, and this way when clicking a hostile monster, the
  only entry is the attack, so will be executed automatically.
  This makes it much more usable.

2 years agoMake mouse clicklook report only the specific tile
Pasi Kallinen [Thu, 25 Aug 2022 14:11:43 +0000 (17:11 +0300)]
Make mouse clicklook report only the specific tile

Previously the mouse clicklook mentioned every tile that matched
the character symbol, leading to overload of information and
if playing with tiles, it was mostly useless. Also the most
important bit - the tile info - was last in the text.

Now mouse clicklook only reports the exact tile information
that was clicked on.

2 years agosort #migratemons list of migrating monsters
PatR [Wed, 24 Aug 2022 22:33:35 +0000 (15:33 -0700)]
sort #migratemons list of migrating monsters

If there are any migrating monsters, #migratemons offers a chance
to view them; display the list in arrival destination order rather
than the arbitrary migrating_mons order.  Doesn't change the list's
order and doesn't apply to viewing 'c' (mons aimed at current level)
or 'n' (mons aimed at next level), just to 'o' (other, neither 'c'
nor 'n') and 'a' (all migrating mons).

2 years agobug fix for listing migrating monsters
PatR [Wed, 24 Aug 2022 21:53:36 +0000 (14:53 -0700)]
bug fix for listing migrating monsters

A typo in the code added to #migratemons resulted in bad output when
listing a subset of migrating monsters if there were any aimed at the
next level.  Didn't affect listing 'a'll because the incorrect code
wasn't reached in that situation.

2 years agocurses: revert accidentally removed code block for #saveoptions
Patric Mueller [Wed, 24 Aug 2022 21:41:31 +0000 (23:41 +0200)]
curses: revert accidentally removed code block for #saveoptions

2 years agocurses: implement a dialog for the windowborders option
Patric Mueller [Wed, 24 Aug 2022 19:03:36 +0000 (21:03 +0200)]
curses: implement a dialog for the windowborders option

2 years agoFix room array overflowing into subrooms
Pasi Kallinen [Wed, 24 Aug 2022 18:30:42 +0000 (21:30 +0300)]
Fix room array overflowing into subrooms

If the map is big enough so that makerooms generates the maximum
allowed number of rooms for the level, the last room will "overflow"
into the subrooms array.

The rooms array assumes the last entry has hx = -1, and add_room
changes the next room hx to -1 but because the subrooms array
is right after the rooms array, this change actually touches
the first subroom on the level.

This has been present since who knows how long, but because
the levels are normally small enough, the room limit is never hit.

2 years agoAdd some hallu monsters
Pasi Kallinen [Wed, 24 Aug 2022 15:40:27 +0000 (18:40 +0300)]
Add some hallu monsters