]> granicus.if.org Git - nethack/log
nethack
6 years agoNetHack minor release checklist items - savefiles
nhmall [Sun, 23 Jun 2019 04:11:46 +0000 (00:11 -0400)]
NetHack minor release checklist items - savefiles

Make some progress on a couple of next minor release checklist
items, hopefully without introducing too many new bugs. This
is just the initial commit, and work continues.

Checklist items:

Savefiles compatible between Windows versions, whether 64-bit
or 32-bit in little-endian field format.

Selection of file formats:
 historical (structlevel saves),
 lendian (little-endian, fieldlevel saves),
 and just for proof-of-concept, ascii fieldlevel saves
 (the ascii is huge! 10x bigger than little-endian).

For the fieldlevel save, all complex data structures recursively
get broken down until until it is one of the simple types that
can't be broken down any further, and that gets when it gets
written to the output file.

New files needed for this build:

hand-coded:
include/sfprocs.h
src/sfbase.c      - really a dispatcher to one of the
                    output/input format routines.
src/sflendian.c   - little-endian output writer/reader.
src/sfascii.c     - ascii text output writer/reader.

auto-coded (generated):
include/sfproto.h
src/sfdata.c

This is just one approach. I'm sure there are countless others
and they have different pros and cons.

For producing the auto-coded files a utility called
universal-ctags, that is actively maintained and evolving,
was used to do all the heavy-lifting of parsing the
NetHack C sources to tabulate the data fields, and store
them in an intermediate file called util/nethack.tags
(not required for building NetHack if you already have a
generated include/sfproto.h and src/sfdata.c)

util/readtags (also not required for building NetHack
itself) will decipher the nethack.tags file and produce
the functions that can deal with the NetHack struct data
fields.

You can obtain the source for universal-ctags by cloning it
from here:
https://github.com/universal-ctags/ctags.git

The combination universal-ctags + util/readtags has been
tried and tested under both Windows and Linux, so it is
not tied to a particular platform.

Note: util/readtags will work only with universal-ctags
output, so other ctags are unlikely to work as-is.
Universal-ctags can be build from source very easily
under Linux, or under Windows using visual studio.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sun, 23 Jun 2019 02:03:07 +0000 (22:03 -0400)]
Merge branch 'NetHack-3.6'

6 years agomakemon() and clone_mon()
PatR [Sat, 22 Jun 2019 20:47:35 +0000 (13:47 -0700)]
makemon() and clone_mon()

Express the logic of various early returns more consistently.

clone_mon() wasn't handling mon->isminion correctly.  I'm not sure
whether it is actually possible to clone a minion (maybe after
polymorphing it into a gremlin or blue jelly?).  When it wasn't tame,
which is the case for every minion other than the guardian angel on
Astral, the emin structure wasn't being allocated for the clone but
its isminion flag was left set.

Also, clones inherited mon->mtrack[] so would unnecessarily avoid
moving onto spots the original had recently moved across.

Cloned pets are inheriting various pet-specific fields that they
probably should be starting with a clean slate on but I haven't made
any attempt to address that.

6 years agofix #H8922 - no "you finish eating" message
PatR [Sat, 22 Jun 2019 20:03:50 +0000 (13:03 -0700)]
fix #H8922 - no "you finish eating" message

after being interrupted and then resuming.  Resuming a multi-turn
food when it only had one bite left was the culprit.

6 years agocode in parse_conf_file() to trim trailing blanks/cr was missing them
nhmall [Sat, 22 Jun 2019 04:05:16 +0000 (00:05 -0400)]
code in parse_conf_file() to trim trailing blanks/cr was missing them

Observed on a text file with crlf endings on Linux, where the
so-called blank lines weren't being ignored as they should
have been, despite there being a line to remove \r from the
end.

A pointer was being pre-decremented before the check for a
matching whitespace character.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Fri, 21 Jun 2019 02:33:33 +0000 (22:33 -0400)]
Merge branch 'NetHack-3.6'

6 years agofix #H8833 - wishing for "<foo> amulet"
PatR [Fri, 21 Jun 2019 01:42:35 +0000 (18:42 -0700)]
fix #H8833 - wishing for "<foo> amulet"

and receiving a random amulet instead of an "amulet of <foo>".
Although the failure to produce the 'right' amulet wasn't a regression
compared to earlier versions as the report indicated, supporting that
wish is straightforward.

6 years agofix #8924 - demonic bribery while hero is deaf
PatR [Thu, 20 Jun 2019 20:08:47 +0000 (13:08 -0700)]
fix #8924 - demonic bribery while hero is deaf

Even though it isn't using verbalize() to make a specific statement,
don't let a demon ask the hero for a bribe when the hero is deaf.

Also, give alternate setup messages in a couple of places where a
divine voice is overriding deafness.

6 years agocomment typo for "transient"
PatR [Thu, 20 Jun 2019 17:59:48 +0000 (10:59 -0700)]
comment typo for "transient"

6 years agomuse wand/horn feedback for monst zapping at self
PatR [Thu, 20 Jun 2019 17:54:59 +0000 (10:54 -0700)]
muse wand/horn feedback for monst zapping at self

Recent commit 5d59b288c9a8e6f15f683007bdf5c4e4549642f4 changed monster
zapping a fire horn at self to cure sliming to not use the wand-zap
feedback routine, but inadvertently did for zaps of wands of fire too.
Use the zap routine for wand and play-instrument routine for horn.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Thu, 20 Jun 2019 14:18:32 +0000 (10:18 -0400)]
Merge branch 'NetHack-3.6'

6 years agoRe-do the formatting for help on menu control keys
PatR [Thu, 20 Jun 2019 09:26:48 +0000 (02:26 -0700)]
Re-do the formatting for help on menu control keys

and add the non-configurable keys:  space, return, and escape.

6 years agoupdate contact URL
PatR [Thu, 20 Jun 2019 08:24:10 +0000 (01:24 -0700)]
update contact URL

Reviewing the help choices revealed an out of date one.

6 years agocurses text windows
PatR [Thu, 20 Jun 2019 08:14:50 +0000 (01:14 -0700)]
curses text windows

Most of the entries for '?' looked awful because curses was using
((terminal_width / 2) - 2) for the window width ('- 2' was to make
for for a border around the popup window, regardless of what the
'windowborder' option was set to).  Splitting text that has been
manually formatted for 80 columns "worked" but looked bad when not
required.

Some of the help files are using 79 characters on a few lines,
producing wrapped text when displayed.  Those would look better if
limited them to 78 or if curses can be modified to suppress the
window border when the entire display is being covered by a popup.

6 years agofuzzer tweak tweak
PatR [Thu, 20 Jun 2019 07:53:45 +0000 (00:53 -0700)]
fuzzer tweak tweak

Recent fuzzer tweak had an unintended side-effect:  NUL character is
used to indicate a mouse click and we weren't setting up fake value
for one of those.  Go back to avoiding NUL when obtaining a random
value for user's keystroke.

6 years agomerge bit
nhmall [Wed, 19 Jun 2019 01:50:51 +0000 (21:50 -0400)]
merge bit

6 years agoMerge branch 'NetHack-3.6'
nhmall [Wed, 19 Jun 2019 01:43:54 +0000 (21:43 -0400)]
Merge branch 'NetHack-3.6'

6 years agocurses map window
PatR [Tue, 18 Jun 2019 10:52:28 +0000 (03:52 -0700)]
curses map window

tty ignores map column #0 (0-based index), like the core, and draws
the map in screen columns 1 (1-based index) through 79, leaving screen
column 80 blank.  curses was drawing all 80 map columns and since #0
was always unused, screen column 1 was blank and the map was shown in
2 through 80.  Change curses to work like tty.

This was too easy; there may be problems lurking.  One known issue: it
should be made smarter about when clipping/panning is necessary since
it thinks that a full 80 columns are needed but 79 suffice.

6 years agomkroom.h update
PatR [Tue, 18 Jun 2019 09:43:41 +0000 (02:43 -0700)]
mkroom.h update

Give room type enums explicit values so that it is easier to find
them when searching by value rather than by name.

Also some reformatting.

6 years agocuring green slime bit
PatR [Tue, 18 Jun 2019 09:39:45 +0000 (02:39 -0700)]
curing green slime bit

A recent change to make_slimed() overlooked a different recent change
in how mon->m_ap_type and youmonst.m_ap_type are referenced.  In this
case it had no impact; fix on general principles.

6 years agomerge branch NetHack-3.6 part 2
nhmall [Mon, 17 Jun 2019 19:25:10 +0000 (15:25 -0400)]
merge branch NetHack-3.6 part 2

6 years agoMerge branch 'NetHack-3.6'
nhmall [Mon, 17 Jun 2019 19:24:53 +0000 (15:24 -0400)]
Merge branch 'NetHack-3.6'

6 years agomonster overflow on Plane of Air
PatR [Mon, 17 Jun 2019 17:09:16 +0000 (10:09 -0700)]
monster overflow on Plane of Air

Make Air behave the same as Earth, Fire, and Water if monsters are
forced off the level for some reason.

6 years agofuzzer tweaks
PatR [Mon, 17 Jun 2019 16:31:01 +0000 (09:31 -0700)]
fuzzer tweaks

Prevent the fuzzer from randomly toggling the 'silent' option.  If
you use the default value of True then this eliminates most--but not
all--of the beeping that happens when it is running.  I'm not sure
where the remaining beeps are coming from.

Modify the random keystroke selection to implement some bias towards
direction keys that I thought had already been there, plus a higher
chance to entering digits to initiate number responses.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sat, 15 Jun 2019 22:54:28 +0000 (18:54 -0400)]
Merge branch 'NetHack-3.6'

6 years agoEDIT_GETLIN when naming monsters and objects
PatR [Sat, 15 Jun 2019 15:19:32 +0000 (08:19 -0700)]
EDIT_GETLIN when naming monsters and objects

Like #annotate, #name monster, #name individual object, and #name
object type are places where it makes some sense to have an existing
name be the default for the new name, in case taking off from the end
and/or adding to the end is more convenient than retyping everything.

When there is an existing name used as default, clearing that default
and hitting <return> is not enough to remove the name, you still need
to 'assign a new name' of <space> to do that.

6 years agotake two: tty bug with long 'autodescribe' text
PatR [Sat, 15 Jun 2019 14:18:47 +0000 (07:18 -0700)]
take two: tty bug with long 'autodescribe' text

Messages on tty which bypass message history weren't handling long
lines properly.  If the text wrapped to line 2, that continuation
portion was left on the screen after whatever operation that put it
here was finished.  (To reproduce:  assign a long name to a monster
with a long type name so that the combined length exceeds the display
width, then move the cursor over it with ';' or '/' while autodescribe
is On.)

This time prompting isn't adversely affected.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sat, 15 Jun 2019 12:54:45 +0000 (08:54 -0400)]
Merge branch 'NetHack-3.6'

6 years agotty bug with multi-line prompts
PatR [Sat, 15 Jun 2019 12:11:08 +0000 (05:11 -0700)]
tty bug with multi-line prompts

This effectively reverts 1ad2415315c1e6dbcdfcd4a4b22b6fb93ccef1f2
because it was interfering with prompts that spanned more than one
line (by inserting '--More-- + erase' between displaying of prompt and
getting input for the answer).

So we're back to the situation where autodescribe feedback when moving
the cursor will leave text on the second line if it generates text too
wide for one line.  (^R redraws the screen correctly.)

6 years agoEDIT_GETLIN vs monpolycontrol
PatR [Sat, 15 Jun 2019 11:13:34 +0000 (04:13 -0700)]
EDIT_GETLIN vs monpolycontrol

For wizard mode 'monpolycontrol', the getlin() answer buffer for the
"Change <monster> @ <x,y> into what kind of monster?" prompt is also
used to format the coordinate portion of that prompt, so when
EDIT_GETLIN is enabled getlin() was inadvertently given "<x,y>" to use
as default response.  Clear it after the prompt is formatted instead
of via an initializer.  Also, shorten the prompt on the first try:
"Change <monster> @ <x,y> into what?", expanding to the old prompt if
retry is needed.

This also allows specifying 'chameleon' when <monster> is a chameleon,
'doppelganger' when it's a doppelganger, and 'sandestin' when it's one
of those (but not 'doppelganger' when it's a chameleon or sandestin,
and so forth), instead of blanket refusal to accept any non-vampire
shapechanger as the choice.

6 years agodo_mname bit
PatR [Thu, 13 Jun 2019 01:04:00 +0000 (18:04 -0700)]
do_mname bit

Couple of tweaks I made to do_mname() while investigating the tty
autodescribe wrapping issue.

6 years agotty bug with displaying long 'autodescribe' text
PatR [Thu, 13 Jun 2019 00:57:24 +0000 (17:57 -0700)]
tty bug with displaying long 'autodescribe' text

Messages on tty which bypass message history weren't handling long
lines properly.  If the text wrapped to line 2, that continuation
portion was left on the screen after whatever operation that put it
here was finished.  (To reproduce:  assign a long name to a monster
with a long type name so that the combined length exceeds the display
width, then move the cursor over it with ';' or '/' while autodescribe
is On.)

6 years agoMerge branch 'NetHack-3.6'
nhmall [Wed, 12 Jun 2019 03:24:41 +0000 (23:24 -0400)]
Merge branch 'NetHack-3.6'

6 years agomklev.c formatting and comments
PatR [Wed, 12 Jun 2019 01:54:32 +0000 (18:54 -0700)]
mklev.c formatting and comments

I made these to 3.7.0- and decided to bring them back to 3.6.2+
because of the 'TODO'.

6 years ago3.7: automatic annotation for vibrating square
PatR [Tue, 11 Jun 2019 16:29:14 +0000 (09:29 -0700)]
3.7: automatic annotation for vibrating square

Add "Gateway to Moloch's Sanctum" to the vibrating square level if you
step on the square or detect/magic map it as a pseudo-trap, an extra
hint for players who manage to get that far but then don't know what
to do next.  (I think I may also add a randomly placed floor engraving
along the lines of "For a good time, consult the Oracle of Delphi."
as a gag variant of "For a good time, call <name> at <phone number>."
Not very thematic for Gehennom but could conceivably nudge someone in
the right direction.  But it could give away the level for experienced
players who haven't located the vibrating square yet.)

The annotation sticks until the one for "Moloch's Sanctum" gets added.
That happens when the temple on the sanctum level is entered or the
altar there has become mapped (in view or via magic mapping).

Could break existing 3.7.0- save files (but probably won't, since
at least two bits were available unless using an ancient 'Bitfield()
allocates whole bytes' configuration).  That's the reason I didn't
put this into 3.6.2+.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Mon, 10 Jun 2019 22:04:45 +0000 (18:04 -0400)]
Merge branch 'NetHack-3.6'

6 years agowizweight vs globs
PatR [Mon, 10 Jun 2019 16:52:34 +0000 (09:52 -0700)]
wizweight vs globs

The wizard mode runtime option 'wizweight' appends an object's weight
to its formatted description, but that was skipped for globs on the
assumption that it had already been included.  But that inclusion only
happens in shops so most globs lacked weight feedback.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Mon, 10 Jun 2019 12:05:46 +0000 (08:05 -0400)]
Merge branch 'NetHack-3.6'

6 years agomuse wand/horn feedback
PatR [Mon, 10 Jun 2019 10:16:52 +0000 (03:16 -0700)]
muse wand/horn feedback

One of the claims in #H8849 was that a monster which zapped a wand
that the hero had fully identified made hero's knowledge of it revert
to "a wand".  That doesn't happen; it had to have been a different
wand which hadn't been seen up close yet.  But the hero should lose
track of known number of charges if a wand is zapped outside his/her
view.  When implementing that I noticed that a monster playing a fire
horn to burn away slime was using the routine that gives wand
feedback.  Add a separate, similar routine for magical horn feedback.

Half this diff is due to moving a naming support routine from mhitm.c
to do_name.c.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sun, 9 Jun 2019 18:09:18 +0000 (14:09 -0400)]
Merge branch 'NetHack-3.6'

6 years agocurses EDIT_GETLIN - discarding preloaded answer
PatR [Sun, 9 Jun 2019 14:07:34 +0000 (07:07 -0700)]
curses EDIT_GETLIN - discarding preloaded answer

EDIT_GETLIN is more complicated on curses than on tty due to way that
long lines are handled....

Using ESC to get rid of the default response removed it from the
answer buffer but didn't erase back to the end of actual prompt,
making it look as if it was still there.  Fixing that for a one-line
prompt+answer was needed and would have been easy but it also needs to
be prepared to go back to prior lines.  Both the prompt and the answer
could conceivably span lines although in practice it will usually just
be one line or else prompt+answer combined spanning to a second line.

This hasn't been exhaustively tested been seems to be working correctly.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sun, 9 Jun 2019 13:45:14 +0000 (09:45 -0400)]
Merge branch 'NetHack-3.6'

6 years agomore ^G of "hidden <monster>"
PatR [Sun, 9 Jun 2019 13:11:09 +0000 (06:11 -0700)]
more ^G of "hidden <monster>"

Fix a couple of glitches and add an enchancement.  The monster
attributes structure left the 'hidden' field uninitialized unless user
specified "hidden".  Mimics were being flagged with mon->mundetected
because they pass the is_hider() test but they 'hide' by taking on an
appearance rather than being unseen due to mundetected.  hides_under()
monsters fail the is_hider() test, but can become mundetected if there
is at least one object present.  Eels/other fish are neither is_hider()
nor hides_under() but can be mundetected at water locations.  So alter
'hidden' handling to deal with these various circumstances.

Asking for 'hidden' for any type of creature will result in having its
location be highlighted if it can't be actively seen or detected.  So
using '2000 ^G piranha' will fill up the Plane of Water "normally" but
'2000 ^G hidden piranha' will result in a ton of draw-glyph/delay/
draw-other-glyph/delay sequences and take a painfully long time.  Moral
of the story:  don't combine 'hidden' with a large count unless you
want to spend quite a while watching the level's fill pattern.  Turning
off the 'sparkle' option will cut the flashing in half but still take
a long time.  If you really need to fill a level with hidden creatures
and can't bear the flashing/highlighting, use blessed potion of monster
detection or #wizintrinsics to have extended detect.  Then all created
monsters will be seen so none will trigger location highlighting.

If you create a 'stalker' or 'invisible stalker' or 'invisible <other-
mon>' its location won't be highlighted, but for 'hidden stalker' or
'hidden invisible stalker' or 'hidden invisible <other-mon>' it will
(provided you don't actually see it due to See_invisible or sensemon()).

6 years agoa 3.7 merge fix for a recent display.c change
nhmall [Sun, 9 Jun 2019 13:01:22 +0000 (09:01 -0400)]
a 3.7 merge fix for a recent display.c change

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sun, 9 Jun 2019 12:43:40 +0000 (08:43 -0400)]
Merge branch 'NetHack-3.6'

6 years agodisplay effect bits
nhmall [Sun, 9 Jun 2019 12:08:50 +0000 (08:08 -0400)]
display effect bits

6 years agoextend wizard-mode display effect to unseen invisible monsters
nhmall [Sun, 9 Jun 2019 11:46:14 +0000 (07:46 -0400)]
extend wizard-mode display effect to unseen invisible monsters

6 years agooverlooked rn2_on_display_rng bit
nhmall [Sun, 9 Jun 2019 11:41:11 +0000 (07:41 -0400)]
overlooked rn2_on_display_rng bit

6 years agomake display effect code reusable and move it to display.c
nhmall [Sun, 9 Jun 2019 03:19:29 +0000 (23:19 -0400)]
make display effect code reusable and move it to display.c

6 years agofixes entry and a display effect related to is_hider wishing
nhmall [Sun, 9 Jun 2019 02:40:51 +0000 (22:40 -0400)]
fixes entry and a display effect related to is_hider wishing

6 years agodebug mode wishing for hidden hiders
nhmall [Sun, 9 Jun 2019 01:54:06 +0000 (21:54 -0400)]
debug mode wishing for hidden hiders

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sat, 8 Jun 2019 18:39:36 +0000 (14:39 -0400)]
Merge branch 'NetHack-3.6'

6 years agofix github pull request #197 - curses CR handling
PatR [Sat, 8 Jun 2019 15:55:44 +0000 (08:55 -0700)]
fix github pull request #197 - curses CR handling

Fixes #197
Fixes #195

Add a call to nonl() to tell curses not to convert carriage return (^M)
to newline.  Line input accepts both ^J and ^M as end of line/end of
input, but the core's command processing treats ^M as "unknown command"
(by default; someone could use the BIND option to assign some command
to that character).  The end result is that accidentally pressing the
<return> or <enter> key (or Ctrl+M key combination) won't make the hero
run towards the bottom of the screen as if the user had typed ^J.  The
curses docs also claim that it allows more optimization during screen
updating by making ^J work as plain linefeed rather than ^M^J newline.

The tty interface can achieve this (the 'do not convert ^M to ^J part',
not the 'more optimization' part) by issuing the command 'stty -icrnl'
(on Unix or sufficiently Unix-like system) prior to running nethack,
but that has no effect when using the curses interface (at least with
ncurses on OSX where I've tested it).

A better fix would be to look up the current terminal settings at
program startup and only call nonl() if -crnl was in effect so that
curses and tty would behave the same in this regard, but curses is
supposed to let us avoid those sorts of messy details....

6 years ago3.7 X11 collission with variable 'g'
PatR [Sat, 8 Jun 2019 14:51:45 +0000 (07:51 -0700)]
3.7 X11 collission with variable 'g'

6 years ago3.7 monst->mtemplit
PatR [Sat, 8 Jun 2019 14:38:13 +0000 (07:38 -0700)]
3.7 monst->mtemplit

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sat, 8 Jun 2019 13:38:27 +0000 (09:38 -0400)]
Merge branch 'NetHack-3.6'

6 years agofix github issue #198 - mon wielding cursed weapon
PatR [Sat, 8 Jun 2019 12:58:42 +0000 (05:58 -0700)]
fix github issue #198 - mon wielding cursed weapon

Fixes #198

Watching a monster try to switch from a cursed weapon to some other
weapon (of any bless/curse state) reported that the old weapon was
welded to the monster's hand and wouldn't switch to the new one.
But watching a monster try to wield a cursed weapon didn't say that
it was becoming welded at the time.  Report correctly pointed out
that the weld-to-hand check wouldn't work unless the weapon was
already flagged as wielded, and the code in question was deferring
wielding so that the message wouldn't include "(weapon in hand)" in
the formatted object description.  There was also another problem:
it was erroneously testing the monster's old weapon (if any, after
unwielding it), instead of the new one being wielded.

Also, Sunsword starting to emit light when first wielded by a monster
only reported that it was shining if hero could see the monster.
Give an alternate message if hero sees the location instead.  (Just
the monster's/Sunsword's location rather than any newly lit spot
within Sunsword's radius.)

6 years agomissile light sources
PatR [Sat, 8 Jun 2019 11:50:40 +0000 (04:50 -0700)]
missile light sources

Throwing or kicking a lit lamp, lit candle, or lit potion of oil
wasn't giving off any light as it travelled to its destination.
Now it does, and dungeon features, objects, or monsters that are
temporarily seen as it moves from square to square till appear on
the map.  In the monster case, they go away as soon as the light
moves beyond range, but when it finishes moving the "remembered,
unseen monster" glyph will be drawn at their location.  I think that
part has some room for improvement, but mapping temporarily seen
terrain features is the primary impetus for this change.

Also, any message delivery while the "lit missile" travelled still
showed its light around the hero.  Noticeable for lamps or stacks
of sufficient candles if hero has no other light source.

This cannibalizes the monst->mburied bit for temporarily seeing a
monster.  It has been present but unused for ages.  I needed to
replace a couple of vision macros to make sure they didn't examine
it any more so that overloading for transient lighting doesn't
introduce any vision oddities.  For version $NEXT, monst->mtemplit
can be given its own bit.  It is only set during bhit() execution
and cleared by the time that returns, so has no effect on save files.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Fri, 7 Jun 2019 01:49:54 +0000 (21:49 -0400)]
Merge branch 'NetHack-3.6'

6 years agovampshifting by poly'd hero
PatR [Thu, 6 Jun 2019 23:51:43 +0000 (16:51 -0700)]
vampshifting by poly'd hero

Hero polymorphed into a vampire or v.lord can use #monster to switch
to vampire bat or fog cloud [or wolf for lord] but it was a one shot
polymorph.  Remember when current form is a shape-shifted vampire and
allow #monster in shifted form to pick another shifted form or the
vampire form.

Genocide of the alternate shape forces back to base vampire.  Genocide
of base vampire does too, then reverts to human (or dwarf, &c) as
vampires go away.  Being killed while shafe-shifted reverts all the
way to human rather than to vampire.  [Just realized:  interaction
with Unchanging wasn't taken into consideration so hasn't been tested.]

Since 'youmonst' isn't saved and restored, I had to add a field to 'u'
to hold youmonst.cham during save/restore.

Tested with 3.6.2+ and seemed to be working (except saving while
shape-shifted restored as ordinary bat/cloud/wolf because new u.mcham
wasn't there to hold youmonst.cham yet).  Builds with 3.7.0- but not
execution tested yet (I didn't want to clobber my current playground).

6 years ago3.7.x saves not compatible with 3.6.x
PatR [Thu, 6 Jun 2019 22:59:27 +0000 (15:59 -0700)]
3.7.x saves not compatible with 3.6.x

6 years ago\#turn comment
PatR [Thu, 6 Jun 2019 20:30:43 +0000 (13:30 -0700)]
\#turn comment

Remove a potential 'TODO' since it turned out [pun intended] to be a
no-op.

6 years ago\#turn mechanics
PatR [Thu, 6 Jun 2019 20:12:39 +0000 (13:12 -0700)]
\#turn mechanics

This part got left out of yesterday's #turn update.

6 years agomerge bit
nhmall [Thu, 6 Jun 2019 12:14:11 +0000 (08:14 -0400)]
merge bit

6 years agoMerge branch 'NetHack-3.6'
nhmall [Thu, 6 Jun 2019 12:09:18 +0000 (08:09 -0400)]
Merge branch 'NetHack-3.6'

6 years ago\#turn mechanics
PatR [Thu, 6 Jun 2019 01:36:55 +0000 (18:36 -0700)]
\#turn mechanics

When looking at something else I stumbled across this.  Using #turn
is described as chanting a formula but was allowed even if hero wasn't
able to speak due to strangulation or speechless polymorph form.
Also, the check for whether a potential target monster was in range
used 'cansee(mx,my)' which required the hero to be able to see but
not necessarily to be able to see the target.  I've changed that to
'couldsee(mx,my)' on the assumption that it was intended to prevent
\#turn from operating through walls.

Also, the comment about the effective range was wrong.  I changed the
comment to match the code rather than vice versa.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Wed, 5 Jun 2019 12:08:32 +0000 (08:08 -0400)]
Merge branch 'NetHack-3.6'

6 years agolocation viability on Plane of Water
PatR [Wed, 5 Jun 2019 11:16:34 +0000 (04:16 -0700)]
location viability on Plane of Water

While testing, I noticed that I could completely fill the Water level
with air elementals.

Hero can't fly or levitate or water walk into/onto water locations
on Water level without drowning/crawling out the water, and monsters
shouldn't have been able to but could, then they were hit by drowning
since minliquid used different criteria than movement.  But goodpos(),
used for teleport destination and new monster creation among other
things, consided water locations acceptable on that level for
non-aquadic creatures with Fly/Lev/Wwalk ability.

It explains why so many dragons and other 'nasty' monsters have been
ending up on the vanquished monsters list when hero uses level
teleport to go directly there from level 1.  They've either been
getting created in water and then they drown when it's their turn to
move or moving into it to approach the hero and drowning (not sure
whether that case is immediate or on next move).  There's no message
since hero doesn't see it, and air elementals didn't drown since thy
don't breathe.

6 years agofixes whitespace bit
nhmall [Wed, 5 Jun 2019 01:58:44 +0000 (21:58 -0400)]
fixes whitespace bit

6 years agoremove some trailing spaces from data.base
nhmall [Wed, 5 Jun 2019 01:49:20 +0000 (21:49 -0400)]
remove some trailing spaces from data.base

6 years agomake sure end.c can place the bc
nhmall [Wed, 5 Jun 2019 01:46:08 +0000 (21:46 -0400)]
make sure end.c can place the bc

6 years agoallow a parent function to restrict use of placebc
nhmall [Wed, 5 Jun 2019 01:18:46 +0000 (21:18 -0400)]
allow a parent function to restrict use of placebc

placebc was triggering an impossible sometimes on the plane of
water

It turned out to be because movebubbles issued an
unplacebc(), but a downstream function called
placebc(), so when movebubbles() issued its own
placebc() there was a problem.

The downstream function that beat movebubbles to the placebc()
turned out to be unstuck(). There could be others.

6 years agoplug montraits() memory leek
PatR [Tue, 4 Jun 2019 21:54:58 +0000 (14:54 -0700)]
plug montraits() memory leek

If a corpse with a revive timer included obj->oextra->omonst for
remembering the original monster (I think all corpses do these days)
and makemon() failed to create a new monster when the timer expired,
the copy of the original wasn't freed.  makemon() will fail if there
is no room for the monster.

6 years agoconfused blessed scroll of remove curse on itself
PatR [Tue, 4 Jun 2019 20:18:21 +0000 (13:18 -0700)]
confused blessed scroll of remove curse on itself

Noticed when testing the set_bknown patch earlier: something updated
the persistent inventory window while scroll processing was in the
midst of traversing invent and it showed the scroll I'd just read
change from known blessed to bless/curse state not known.  The scroll
should really be removed from inventory because player is told that it
has disappeared, but unlike charging (which does do that so that it is
gone when selecting an item to charge), remove curse isn't auto-IDed
and the code to ask the player to call an unIDed item something only
kicks in when it's still in inventory.  Preventing the scroll in use
from having its bknown flag cleared should be good enough; it won't
have disappeared yet but at least it won't be visibly changing.

6 years agocontainer->{cknown,lknown) vs perm_invent
PatR [Tue, 4 Jun 2019 19:13:46 +0000 (12:13 -0700)]
container->{cknown,lknown) vs perm_invent

Carried containers could have their contents-known state and/or
lock-known state changed without persistent inventory window being
updated to show the new information.

This also changes the behavior when player has hero zap self with
wand of locking or wizard lock spell.  If it doesn't trigger a
holding trap then the effect will hit inventory, similar to how
opening/knock operates (releasing hero from holding trap or hiting
inventory when that doesn't happen).

6 years agofix #H8850 - bless/curse state in perm_invent
PatR [Tue, 4 Jun 2019 17:50:24 +0000 (10:50 -0700)]
fix #H8850 - bless/curse state in perm_invent

Changing an inventory item's bknown flag wasn't followed by a call to
update_inventory() in many circumstances, so information which should
have appeared wasn't showing up until some other event triggered an
update.

6 years agofix github issue #196 - green slime feedback
PatR [Tue, 4 Jun 2019 16:16:00 +0000 (09:16 -0700)]
fix github issue #196 - green slime feedback

Fixes #196

If you didn't die from turning into green slime but then died because
green slimes had been genocided, the message given assumed that you
had just seen "OK, you don't die" from answering No to "Really die?".
Its wording didn't make sense if the reason you didn't die was an
amulet of life-saving.  Give a different message for that case.

Also, if you survive turning into slime (via either method) and either
green slimes are still around or you answer No to "Really die?" when
they've been genocided, give a message after "You survived that attempt
on your life" pointing out that you have done so in green slime form.
Useful since prior to 3.6.2 you would have reverted to original form--
despite the Slimed countdown saying you had turned into green slime.

6 years agodisabled code bit
nhmall [Mon, 3 Jun 2019 22:45:02 +0000 (18:45 -0400)]
disabled code bit

6 years agoadd some debugging BREADCRUMBS to identify caller of some functions
nhmall [Mon, 3 Jun 2019 22:37:45 +0000 (18:37 -0400)]
add some debugging BREADCRUMBS to identify caller of some functions

Only takes effect if a developer uncomments BREADCRUMBS in config.h

6 years agodata.base update
nhmall [Mon, 3 Jun 2019 22:00:19 +0000 (18:00 -0400)]
data.base update

6 years agomore precautions for monster obliteration during overcrowding
nhmall [Mon, 3 Jun 2019 21:11:54 +0000 (17:11 -0400)]
more precautions for monster obliteration during overcrowding

6 years agoextended ball&chain sanity check
PatR [Mon, 3 Jun 2019 09:36:44 +0000 (02:36 -0700)]
extended ball&chain sanity check

Verify that the locations of ball and chain are consistent.
If chain is on floor then ball is on floor or in hero's inventory
else if chain is free then ball is free or in hero's inventory.
When chain is on floor it is under hero or one step away from hero
and when ball is on floor it is on chain or one step away from chain.

6 years agomakedefs: add enum support when generating pm.h
nhmall [Sun, 2 Jun 2019 21:21:35 +0000 (17:21 -0400)]
makedefs: add enum support when generating pm.h

Only changes pm.h content if ENUM_PM is defined when compiling
util/makedefs.c

While NON_PM and LOW_PM could be included, it would require
for the makedefs.c compile, as well as an
around their macro definitions in permonst.h so for now those
particular lines are commented out in makedefs.c

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sun, 2 Jun 2019 20:19:53 +0000 (16:19 -0400)]
Merge branch 'NetHack-3.6'

6 years agodon't clear mtmp->mx, mtmp->my even when obliterating
nhmall [Sun, 2 Jun 2019 14:34:38 +0000 (10:34 -0400)]
don't clear mtmp->mx, mtmp->my even when obliterating

6 years agoelemental_clog() should not destroy the very monster trying to be placed
nhmall [Sun, 2 Jun 2019 12:15:41 +0000 (08:15 -0400)]
elemental_clog() should not destroy the very monster trying to be placed

6 years agoplace_object(obj,0,0) debugging
PatR [Sun, 2 Jun 2019 12:02:08 +0000 (05:02 -0700)]
place_object(obj,0,0) debugging

Got a hit (on Plane of Water) pretty quickly.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Sat, 1 Jun 2019 22:05:42 +0000 (18:05 -0400)]
Merge branch 'NetHack-3.6'

6 years agoremove a couple of debugging lines in mon.c
nhmall [Sat, 1 Jun 2019 21:36:54 +0000 (17:36 -0400)]
remove a couple of debugging lines in mon.c

6 years agofix gcc warning on linux
nhmall [Sat, 1 Jun 2019 21:26:15 +0000 (17:26 -0400)]
fix gcc warning on linux

6 years agoimprove full level handling in the endgame
nhmall [Sat, 1 Jun 2019 20:51:10 +0000 (16:51 -0400)]
improve full level handling in the endgame

Even though a goodpos failure in mnearto() would return 0 to
the caller and trigger proper overcrowding handling for mtmp,
the 'othermon' would be left with its mx,my set to 0,0 under
that circumstance and then trigger a mon_sanity_check()
failure and accompanying impossible() message a short while
afterwards.

This also includes the addition of some flags that proved useful
for troubleshooting the mystery sanity_check failure and helping
to understand some of the code paths the struct monst data had
been through. They are only used for inspection when issues are
reported or when debugging, they don't presently control the
code flow.  Their setting and use is done in an overloaded way
that should not intrude on the existing use of mspare1 for
MIGR_LEFTOVERS. mon->mstate is just a pseudonym for mon->mspare1
and does not alter save file content.

6 years agowhatdoes ('&') for movement commands
PatR [Sat, 1 Jun 2019 09:52:32 +0000 (02:52 -0700)]
whatdoes ('&') for movement commands

The key binding overhaul broke '&' reporting for movement commands.
This is somewhat clumsy but seems to be working as intended.

(M-0 with 'number_pad' set to 2 (or 4) appears to be broken.  It's
supposed to be a synonym for 'I' but brings full inventory ('i')
for me.  I have to set 'altmeta' On and type ESC followed by 0, but
that sequence does work to get M-0.)

6 years agohelp bits
PatR [Sat, 1 Jun 2019 01:41:37 +0000 (18:41 -0700)]
help bits

Fix a typo (count example "20s." shouldn't have the period).

Also expand the text for several gotchas that tend to hit newbies.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Fri, 31 May 2019 21:59:11 +0000 (17:59 -0400)]
Merge branch 'NetHack-3.6'

6 years agofix github issue #193 - curses: menu search
PatR [Fri, 31 May 2019 17:11:45 +0000 (10:11 -0700)]
fix github issue #193 - curses: menu search

Fixes #193

Under curses interface, make characters which are both entry selectors
and menu commands function as a selector.  Needed to support using ':'
to look inside a container when applying/looting it via menu, instead
of performing a menu search operation.  (There was another case like
this but I can't remember what the circumstances are.  The fix is
general enough to cover it, whatever it is.)

For menus which don't have ':' as a choice, make sure search prompt
doesn't offer garbage default input when built with EDIT_GETLIN.

Bug?  If player has 'popup_dialog' option On, EDIT_GETLIN is ignored.
Plain curses I/O doesn't seem to offer a way to implement it.

6 years agoedge of map feedback
PatR [Fri, 31 May 2019 14:35:37 +0000 (07:35 -0700)]
edge of map feedback

When testing Planes of Air and Water, I found it odd that trying to
move off the edge of a level uses a turn but provides no feedback.
If 'mention_walls' is On, report that you can't go any farther in
whichever direction you're trying to move.  Moving diagonally is
only blocked in one of the two combined directions unless you're in
the very corner, so if you try to move southwest while in the middle
of the bottom row, for instance, it says you can't go farther south
rather than southwest.

6 years agoPlanes of Water and Air
PatR [Fri, 31 May 2019 10:42:06 +0000 (03:42 -0700)]
Planes of Water and Air

Make the Plane of Water be water all the way to edge instead of having
stone on left, top, and right.  The Plane of Air already has air all
the way to edge (including unused/unuseable column #0) but does so via
code rather than the level description file so Water does that now too.

The edges of the Plane of Air were cloudless (3 columns on the left,
2 rows on the top, and 2 columns on the right; don't recall about the
bottom) and that looked pretty strange.  Those rows and columns are
beyond the range of bubble/cloud movement so just make some of those
spots randomly be sight-blocking cloud terrain instead of all open air.
It isn't integrated with the moving clouds but looks fairly good when
the hero moves along the edge of the level.

Using wizard mode to leave Water or Air and later return resulted in
no clouds on the Air level and bubbles as usual on the Water level.
I still don't understand why, but on return to those levels run the
bubble creation routine as if the old discarded bubbles or clouds were
being restored.

6 years agoMerge branch 'NetHack-3.6'
nhmall [Thu, 30 May 2019 22:10:41 +0000 (18:10 -0400)]
Merge branch 'NetHack-3.6'

6 years agomnearto/mnexto/enexto
PatR [Thu, 30 May 2019 14:50:38 +0000 (07:50 -0700)]
mnearto/mnexto/enexto

This doesn't solve the <0,0> problem but it does prevent mnexto()
from using uninitialized coordinates if enexto() fails.  It also adds
several debugging messages.

enexto() was ignoring map row #0 (unlike column #0, row #0 contains
valid map locations).  Fixing that doesn't matter for Plane of Water
though since that row is stone there--that's probably a bug.  It was
also repeatedly re-testing the top+1 and bottom rows and left and
right columns after they had already failed to be acceptable.  It
still does some of that, but less.

6 years agosortloot memory leak
PatR [Wed, 29 May 2019 11:40:54 +0000 (04:40 -0700)]
sortloot memory leak

Unfreed memory noticed after interrupting the fuzzer and quitting.
query_objlist() has an early return--for touching a cockatrice
corpse--that was skipping release of sortloot info (an array with
one element per object from whichever object list was being used).

Some formatting that's been sitting around for a while got mixed in
and I decided not to take that back out.