]> granicus.if.org Git - nethack/log
nethack
3 years agomigrating monster fix
PatR [Sat, 14 May 2022 10:30:45 +0000 (03:30 -0700)]
migrating monster fix

The change to zero out a monster's map coordinates when it is taken
off the map yesterday messed up migration between levels inside the
Wizard's tower.  (Didn't apply when accompanying the hero between
levels, so probably unlikely to be noticed.)

Noticed while moving some replicated code into its own routine.

3 years agomore writing novels
PatR [Fri, 13 May 2022 23:47:00 +0000 (16:47 -0700)]
more writing novels

Instead of always retaining a blank spellbook when failing to write a
novel, make 2/3 chance to retain and 1/3 chance to destroy.  Same odds
(but separate chance) to attempt to write the Great Yendorian Novel
versus awful fan fiction.

3 years agopull request #761 - writing novels
PatR [Fri, 13 May 2022 23:04:02 +0000 (16:04 -0700)]
pull request #761 - writing novels

Pull request by entrez:  don't create a Pratchett novel by writing
"novel" or "paperback book" on a known blank spellbook with a magic
marker.

Blanking a novel produces a blank spellbook; there isn't any blank
novel.  That's intentional.  Writing "novel" on a blank spellbook
and getting a randomly chosen Pratchett one wasn't intentional.

Closes #761

3 years agoPrevent hero from writing Pratchett books
Michael Meyer [Fri, 13 May 2022 15:53:58 +0000 (11:53 -0400)]
Prevent hero from writing Pratchett books

The hero's ability to channel Pratchett and write his books with a magic
marker once she had read or IDed at least one of them seemed strange,
especially cases like an illiterate hero doing it as her first
introduction to the written word.  Block the hero from writing random
novels with a marker.

The image of the hero sitting down in the dungeon to write a novel is
funny, so it feels like a good spot for a funny message.  I'm not
sure if what I have there is perfect, but it can always be changed.

3 years agopull request #760 - kickobjnam
PatR [Fri, 13 May 2022 22:57:03 +0000 (15:57 -0700)]
pull request #760 - kickobjnam

Add pull request by argrath:  only one of the calls to new kick_ouch()
needs to pass 'kickobjnam'.

Closes #760

3 years agokickobjnam on dokick() is assigned only kicking object
SHIRAKATA Kentaro [Thu, 12 May 2022 11:18:31 +0000 (20:18 +0900)]
kickobjnam on dokick() is assigned only kicking object

3 years agodisplay former possessions of dead monster
PatR [Fri, 13 May 2022 21:46:02 +0000 (14:46 -0700)]
display former possessions of dead monster

Reported directly to devteam by a hardfought player and also by
entrez.  The recent mon_leaving_level() change resulted in objects
dropped by a dying monster not being displayed immediately.

It justed needed the relobj(mon, 0, FALSE) to relobj(mon, 1, FALSE)
change in m_detach() but this does some related cleanup in
mon_leaving_level()'s callers.  wormgone() takes a long worm off the
map but leaves its stale coordinates set because some code relied on
that.  This takes away the need for that but still doesn't actually
clear them.

This adds redundant 'return' statements at the end of a few void
functions that are longer than fits within a typical screen display.
They make searching for the end of the current routine in an editor
or pager easier without resorting to regular expressions and can
also be used to search for the beginning if/when preceding routine
ends in 'return' too.

3 years agoyet more version buf
nhmall [Fri, 13 May 2022 00:10:27 +0000 (20:10 -0400)]
yet more version buf

3 years agomore version buf
nhmall [Thu, 12 May 2022 23:56:16 +0000 (19:56 -0400)]
more version buf

3 years agobuf sizes in version.c
nhmall [Thu, 12 May 2022 23:38:50 +0000 (19:38 -0400)]
buf sizes in version.c

there were some 'sizeof buf' on a passed pointer variable buf.
pass the actual buffer size in a second argument.

3 years agoun-macro some of display.h
PatR [Thu, 12 May 2022 21:42:20 +0000 (14:42 -0700)]
un-macro some of display.h

I recently captured preprocessor output for a file and the amount of
code being expanded--and subsequently compiled--for canspotmon() was
quite an eye opener.  This converts most of the macros it uses into
function calls.  The resulting executable generated for OSX (built
for x86_64 and containing four interfaces) is about 5.5% smaller! and
there wasn't any difference in speed that I could notice.

The knowninvisible() macro has been in error for as far back as the
git logs go (which include those for the second cvs repository, so
over 20 years now).

3 years agoDon't include /fsanitize=address in vs 2017
nhmall [Thu, 12 May 2022 12:05:28 +0000 (08:05 -0400)]
Don't include /fsanitize=address in vs 2017

Closes #759

3 years agorecharging
PatR [Thu, 12 May 2022 05:11:42 +0000 (22:11 -0700)]
recharging

Make "recharging" and "scroll of recharging" be aliases for "scroll
of charging" when wishing.

I thought this had been put in place years ago.

3 years agoXcode project update
nhmall [Wed, 11 May 2022 20:38:27 +0000 (16:38 -0400)]
Xcode project update

3 years agoredundant "shopkeeper disappears" message
PatR [Wed, 11 May 2022 20:12:25 +0000 (13:12 -0700)]
redundant "shopkeeper disappears" message

Reported directly to devteam by entrez, the rloc() monst vanishes/
appears nearby/&c message was being given before "satisified, <shk>
suddenly disappears" making the latter redundant.  As discussed, the
fix isn't as simple as suppressing one message or the other because
both are given conditionally.

This seems to solve it but has only been lightly tested.

3 years agocorrect the qt5 package instructions for ubuntu
nhmall [Wed, 11 May 2022 13:47:00 +0000 (09:47 -0400)]
correct the qt5 package instructions for ubuntu

3 years agowarning fix
nhmall [Wed, 11 May 2022 01:10:02 +0000 (21:10 -0400)]
warning fix

3 years agoredo magic whistle feedback
PatR [Tue, 10 May 2022 22:53:24 +0000 (15:53 -0700)]
redo magic whistle feedback

Give more information when magic whistle is already discovered and
applying it affects multiple pets, without much increase in verbosity.
For each of the three categories
 1) was already in view and moves to another spot still in view,
 2) was out of view and arrives at a spot within view,
 3) was in view but gets sent to a spot out of view,
show the pet by name (which might be "your <monst>" if it hasn't been
named) when there is just one, or "two creatures", "three...", "four...",
"several...", or "many..." when there are more than one.  The first
category with more than 1 says "creatures".  When there are additional
categories with more than 1, their part of the message says "others" if
prior part(s) already mention "creatures", or it says "other creatures"
if the prior part(s) only list pets by name.

For example
|Three creatures appear.
|Fido shifts location and Fang appears.
|Your pony shifts location and two other creatures appear.
|Many creatures shift locations, several others appear, and two others
disappear.
|Two creatures appear and two others disappear.

3 years agofix one more lua file header
nhmall [Tue, 10 May 2022 15:30:30 +0000 (11:30 -0400)]
fix one more lua file header

3 years agoupdate lua file headers
nhmall [Tue, 10 May 2022 15:26:52 +0000 (11:26 -0400)]
update lua file headers

3 years agoupdate headers on Lua files
nhkeni [Tue, 10 May 2022 11:44:26 +0000 (07:44 -0400)]
update headers on Lua files

3 years agomissed a reference in README
nhmall [Mon, 9 May 2022 21:58:26 +0000 (17:58 -0400)]
missed a reference in README

3 years agoupdate README to reflect a recent file name change
nhmall [Mon, 9 May 2022 21:55:49 +0000 (17:55 -0400)]
update README to reflect a recent file name change

3 years agoMerge branch 'pr758' into NetHack-3.7
nhmall [Mon, 9 May 2022 21:16:30 +0000 (17:16 -0400)]
Merge branch 'pr758' into NetHack-3.7

3 years agosplit getting kick damages into separate function
nhmall [Mon, 9 May 2022 21:15:31 +0000 (17:15 -0400)]
split getting kick damages into separate function

Closes #758 by argrath

3 years agosplit getting damages with a kick into separate function
SHIRAKATA Kentaro [Tue, 3 May 2022 18:19:58 +0000 (03:19 +0900)]
split getting damages with a kick into separate function

3 years agobump patchlevel
nhmall [Mon, 9 May 2022 13:15:17 +0000 (09:15 -0400)]
bump patchlevel

3 years agoMerge branch 'pr757' into NetHack-3.7
nhmall [Mon, 9 May 2022 13:06:50 +0000 (09:06 -0400)]
Merge branch 'pr757' into NetHack-3.7

3 years agosplit adjusting attributes into separate function
nhmall [Mon, 9 May 2022 13:05:58 +0000 (09:05 -0400)]
split adjusting attributes into separate function

Closes #757 by argrath

3 years agoMerge branch 'fix-do-wear' of https://github.com/argrath/NetHack into pr757
nhmall [Mon, 9 May 2022 13:04:56 +0000 (09:04 -0400)]
Merge branch 'fix-do-wear' of https://github.com/argrath/NetHack into pr757

3 years agoMerge branch 'pr754' into NetHack-3.7
nhmall [Mon, 9 May 2022 13:04:22 +0000 (09:04 -0400)]
Merge branch 'pr754' into NetHack-3.7

3 years agosplit kicking empty space into separate function
nhmall [Mon, 9 May 2022 13:03:24 +0000 (09:03 -0400)]
split kicking empty space into separate function

Closes #754 by argrath

3 years agoMerge branch 'fix-kick' of https://github.com/argrath/NetHack into pr754
nhmall [Mon, 9 May 2022 13:02:01 +0000 (09:02 -0400)]
Merge branch 'fix-kick' of https://github.com/argrath/NetHack into pr754

3 years agoMerge branch 'pr748' into NetHack-3.7
nhmall [Mon, 9 May 2022 12:56:19 +0000 (08:56 -0400)]
Merge branch 'pr748' into NetHack-3.7

3 years agofixes entry for pr748
nhmall [Mon, 9 May 2022 12:55:40 +0000 (08:55 -0400)]
fixes entry for pr748

3 years agoMerge branch 'altarmask-sanctum-bit' of https://github.com/entrez/NetHack into pr748
nhmall [Mon, 9 May 2022 12:47:02 +0000 (08:47 -0400)]
Merge branch 'altarmask-sanctum-bit' of https://github.com/entrez/NetHack into pr748

3 years agofollow-up bit in utf8map.c
nhmall [Mon, 9 May 2022 11:46:54 +0000 (07:46 -0400)]
follow-up bit in utf8map.c

3 years agosplit adjusting attributes into separate function
SHIRAKATA Kentaro [Wed, 4 May 2022 17:10:49 +0000 (02:10 +0900)]
split adjusting attributes into separate function

3 years agorgbstr_to_uint32() -> rgbstr_to_int32()
nhmall [Mon, 9 May 2022 11:31:30 +0000 (07:31 -0400)]
rgbstr_to_uint32() -> rgbstr_to_int32()

Closes #756

3 years agomagic whistle fix
PatR [Mon, 9 May 2022 10:21:53 +0000 (03:21 -0700)]
magic whistle fix

Restore old behavior of magic whistle causing pets to be moved to
different locations even when already adjacent to the hero.

This lets rloc() give its relatively new, more verbose messages if
a magic whistle isn't discovered yet but suppresses those when
already discovered in order to issue its own message.  For a single
pet that starts within view and arrives elsewhere within view it says
"shifts location" rather than "vanishes and reappears".  For multiple
pets, it gives one summary message instead of a separate one for each
pet affected by whistling.

3 years agoregression in process_text_window()
nhmall [Mon, 9 May 2022 00:27:00 +0000 (20:27 -0400)]
regression in process_text_window()

original code:

     if (linestart && (*cp & 0x80) != 0) {
         g_putch(*cp);
         end_glyphout();
         linestart = FALSE;
     } else {
         (void) putchar(*cp);
     }

new code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }

The new code didn't output a character if linestart was true and the character did
not have bit 0x80 set.

fixed code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        } else {
            (void) putchar(*cp);
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }

3 years agoLua sandbox
nhkeni [Sat, 7 May 2022 21:45:36 +0000 (17:45 -0400)]
Lua sandbox

Change table format to handle functions never to be included.
Clean up bit masks and tables of functions.
Remove some old comments and out-of-date code.

3 years agotile.c must match target for crosscompile
nhmall [Sat, 7 May 2022 19:06:43 +0000 (15:06 -0400)]
tile.c must match target for crosscompile

3 years agomore preprocessor and multiplatform cleanup
nhmall [Sat, 7 May 2022 19:00:11 +0000 (15:00 -0400)]
more preprocessor and multiplatform cleanup

in wintty.c

3 years agoRevert "some follow-up for MSDOS build"
nhmall [Sat, 7 May 2022 18:34:06 +0000 (14:34 -0400)]
Revert "some follow-up for MSDOS build"

This reverts commit 36d3b6432614315b81eeb5b300b3a98265acc016.

3 years agosome follow-up for MSDOS build
nhmall [Sat, 7 May 2022 17:08:02 +0000 (13:08 -0400)]
some follow-up for MSDOS build

The preprocessor directives in win/tty/wintty.c were crossed-up
under MSDOS build. I think I got them straightened out now.

For a crosscompile situation, the tilemap utility (which runs on
the host) needs to produce an output src/tile.c that is compatible
for the target platform.

Don't use ENHANCED_SYMBOLS under MSDOS, for now anyway.

3 years agodochugw(mon, X)
PatR [Sat, 7 May 2022 16:11:09 +0000 (09:11 -0700)]
dochugw(mon, X)

Reverse the sense of dochugw()'s new 'X' argument. Use True for the
usual case and False for the special case rather than the other way
around.

Call the special case variant when a monster teleports so that hero
stops occupation if the monster jumps to a position where it becomes
a threat.

3 years agoclear a warning during build with vs project
nhmall [Sat, 7 May 2022 15:34:24 +0000 (11:34 -0400)]
clear a warning during build with vs project

src/nhlua.c(93,16): warning C4324: 'nhl_user_data': structure was padded
due to alignment specifier

3 years agoGuidebook.txt cron daily update
nhmall [Sat, 7 May 2022 15:27:05 +0000 (11:27 -0400)]
Guidebook.txt cron daily update

3 years agoVisual studio project updates
nhmall [Sat, 7 May 2022 15:19:59 +0000 (11:19 -0400)]
Visual studio project updates

3 years agoClean up CI build for Windows
nhmall [Sat, 7 May 2022 15:00:13 +0000 (11:00 -0400)]
Clean up CI build for Windows

3 years agotrailing blank removal
nhmall [Sat, 7 May 2022 14:40:21 +0000 (10:40 -0400)]
trailing blank removal

3 years agoENHANCED_SYMBOLS
nhmall [Sat, 7 May 2022 14:25:13 +0000 (10:25 -0400)]
ENHANCED_SYMBOLS

A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c

3 years agosplit kicking empty space into separate function
SHIRAKATA Kentaro [Tue, 3 May 2022 17:50:29 +0000 (02:50 +0900)]
split kicking empty space into separate function

3 years agofix comment (copy/paste victim)
PatR [Sat, 7 May 2022 07:38:44 +0000 (00:38 -0700)]
fix comment (copy/paste victim)

3 years agofix github issue #752 - characteristics init
PatR [Sat, 7 May 2022 07:25:03 +0000 (00:25 -0700)]
fix github issue #752 - characteristics init

Issue #752 by vultur-cadens:  initialization of characteristics had
off by one errors when reducing over-allocation and when increasing
under-allocation, biasing Str over Cha.

This simplifies the code very slightly but it still seems somewhat
confusing to me.

A couple of reformatting bits are included.

Closes #752

3 years agoautounlock parsing confusion
PatR [Sat, 7 May 2022 01:41:54 +0000 (18:41 -0700)]
autounlock parsing confusion

For char *next; don't compare (next = index(...)) != '\0'.
'\0' has value 0 and 0 used in a pointer context is a null pointer.
So the code worked as intended even though it wasn't written as
what was intended.  Fix: take off the char decoration.

3 years agobusy hero ignoring monster threat
PatR [Sat, 7 May 2022 01:30:06 +0000 (18:30 -0700)]
busy hero ignoring monster threat

Fix the problem reported by entrez of a zombie corpse reviving and
crawling out of the ground while the hero was busy doing something
(searching, digging, &c) and having the hero fail to react and just
keep doing whatever the thing was because the zombie was already
inside the range where a monster changes from no-threat to threat.

Done in the monster creation routine so any new monster (including
one revived from a corpse) that is visible,&c will cause the hero's
action to be interrupted.  Teleport arrival probably needs this too.

Only interrupts an occupation, not other voluntary multi-turn
actitivy such as running or traveling.  That would be trivial to
change ['if (g.occupation...' to 'if ((g.occupation || multi > 0)...']
but I'm not sure whether it ought to be extended to that.

3 years agoautounlock:untrap
PatR [Fri, 6 May 2022 21:44:57 +0000 (14:44 -0700)]
autounlock:untrap

Implement 'untrap' as an 'autounlock' action.  Quite a bit more work
than anticipated.  The new documentation is rather clumsy; too many
if-this and if-not-that clauses have intruded.

I'll be astonished if all the return values are correct....

[A couple of places were checking for (rx != 0 && ry != 0) to decide
whether they were performating an autounlock action at <rx,ry> but
that erroneously excludes the top line of the map if the current
level extends that far.  Just check rx for zero/non-zero.]

3 years agominor trapped container changes
PatR [Fri, 6 May 2022 20:27:11 +0000 (13:27 -0700)]
minor trapped container changes

When probing a trapped container, report that it is trapped.
Done with a one-line message in the zap code and also in the title
of the contents display if it isn't empty.

For wizard mode wishing, if both "trapped" and "broken" are specified,
produce an untrapped container with a broken lock.

Also for wizard mode wishing, ignore "trapped" if player wishes for
"trapped secret door".

3 years agoFix coloring of unaligned temple altars
Michael Meyer [Sat, 30 Apr 2022 18:04:18 +0000 (14:04 -0400)]
Fix coloring of unaligned temple altars

They were showing up as gray/neutral, rather than red/unaligned.

3 years agoDesignate high altars with dedicated altarmask bit
Michael Meyer [Wed, 22 Sep 2021 20:57:29 +0000 (16:57 -0400)]
Designate high altars with dedicated altarmask bit

High altars and normal temple altars had identical altarmasks, so
there was no way to distinguish between the two based on the altarmask
alone.  Instead, anywhere it was necessary to determine whether an altar
was a high altar included a check whether the hero was currently the
Astral Plane or Moloch's Sanctum, and assumed any temple altar was the
high altar.

Since there's an extra, unused bit in altarmask anyway, use it to
explicitly mark high altars -- the lua level files already distinguish
between normal temple altars and so-called 'sanctum' altars anyway, so
rather than throwing away this distinction when generating the level,
keep it in the altarmask and use it in place of various u.uz checks.

I think this would require incrementing EDITLEVEL again...

3 years agoautounlock overhaul
PatR [Thu, 5 May 2022 02:13:28 +0000 (19:13 -0700)]
autounlock overhaul

This gives the player more control over what autounlock does.  It is
now a compound option rather than a boolean, and takes values of
  autounlock:none
  !autounlock or noautounlock (shortcuts for none)
  autounlock:untrap + apply-key + kick + force (spaces are optional
    or can be used instead of plus-signs, but can't mix "foo bar+quux")
  autounlock (without a value, shortcut for autounlock:apply-key).
Default is autounlock:apply-key.

Untrap isn't implemented (feel free to jump in) so is suppressed from
the 'O' command's new sub-menu for autounlock.  It's parsed and
accepted from .nethackrc but won't accomplish anything.

[Just musing: it should be feasible to kick in direction '.' to break
open a container or #force to an adjacent spot to break open a door.
If that was done, autounlock:kick+force (or more likely autounlock:
apply-key+kick+force when lacking a key) would resort to force if hero
couldn't kick due to wounded legs or riding.

This changes struct flags so increments EDITLEVEL again.

This includes pull requests #750 from entrez and #751 from FIQ but was
entered from scratch rather than using use their commits.

Closes #750
Closes #751

3 years agoskipinvert handling in tty menus
PatR [Wed, 4 May 2022 21:19:16 +0000 (14:19 -0700)]
skipinvert handling in tty menus

Select all and unselect all were passing the wrong third argument to
menuitem_invert_test().  Select page and unselect page had it right.

3 years agounreferenced local variable warning
nhmall [Wed, 4 May 2022 12:48:56 +0000 (08:48 -0400)]
unreferenced local variable warning

3 years agopull request #749 - MSGHANDLER for #if WIN32
PatR [Tue, 3 May 2022 21:43:44 +0000 (14:43 -0700)]
pull request #749 - MSGHANDLER for #if WIN32

github pull request #749 by argrath:  add support for MSGHANDLER for
WIN32 using spawn() rather than the fork()+exec() used on UNIX.

Closes #749

3 years agoupdate condition for displaying on #version
SHIRAKATA Kentaro [Thu, 4 Nov 2021 20:16:28 +0000 (05:16 +0900)]
update condition for displaying on #version

3 years agoadd msghandler support for win32
SHIRAKATA Kentaro [Thu, 4 Nov 2021 20:16:28 +0000 (05:16 +0900)]
add msghandler support for win32

3 years agoFix warnings, add newline before function braces
Pasi Kallinen [Mon, 2 May 2022 09:46:02 +0000 (12:46 +0300)]
Fix warnings, add newline before function braces

3 years agonhlua.c: bugfix - remove the handler after calling lua_pcall()
nhkeni [Mon, 2 May 2022 01:09:59 +0000 (21:09 -0400)]
nhlua.c: bugfix - remove the handler after calling lua_pcall()

3 years agopets and portals
PatR [Sun, 1 May 2022 22:09:17 +0000 (15:09 -0700)]
pets and portals

Extend pull request #737,
commit d6ab241b8c39830de41c61f6fc2df5760d239cb9, to magic portals.
If hero is on or next to a magic portal, have pets behave as if food
they want is being carried, like PR #737 did for hero standing on
stairs.  (To be on one, hero must have come through from the other
side and not moved off the receiving portal yet, or else is in the
endgame but no longer carrying the Amulet.)

3 years agowarning bits on Windows build
nhmall [Sun, 1 May 2022 16:18:45 +0000 (12:18 -0400)]
warning bits on Windows build

src/nhlua.c(1606): warning C4127: conditional expression is constant
src/nhlua.c(2032): warning C4127: conditional expression is constant

3 years agoRemove extra full stop from SOUND error
Pasi Kallinen [Sat, 30 Apr 2022 13:53:47 +0000 (16:53 +0300)]
Remove extra full stop from SOUND error

3 years agopull request #728 - high-altar desecration
PatR [Sat, 30 Apr 2022 06:22:45 +0000 (23:22 -0700)]
pull request #728 - high-altar desecration

Pull request from argrath:  move code to handle the desecration of a
high-altar out of dosacrifice() into a separate routine.

Closes #728

3 years agoSeparate some codes for desecratintg high altar
SHIRAKATA Kentaro [Sat, 26 Mar 2022 19:15:23 +0000 (04:15 +0900)]
Separate some codes for desecratintg high altar

... and remove one goto.

3 years agopull request #747 - tty_add_menu() defensiveness
PatR [Sat, 30 Apr 2022 06:10:55 +0000 (23:10 -0700)]
pull request #747 - tty_add_menu() defensiveness

Pull request by argrath:  remove an unneeded test for Null when
setting up a new menu entry for tty.

Closes #747

3 years agoremove redundant condition on tty_add_menu()
SHIRAKATA Kentaro [Tue, 8 Feb 2022 18:44:04 +0000 (03:44 +0900)]
remove redundant condition on tty_add_menu()

`newstr` is assigned to `str` or `buf`.
`buf` is an address of an array, and `str` is guarded,
so both are non-NULL.

3 years agoavoid new "where are we?" panic
PatR [Sat, 30 Apr 2022 06:00:51 +0000 (23:00 -0700)]
avoid new "where are we?" panic

savelev() gets run to clean up memory even if the player quits before
level 1 is created, and a change made yesterday panicked if it couldn't
figure out what level the hero is on.  Caught by entrez, again....

If not actually writing a level's file, don't panic if both u.uz and
g.uz_save are 0.  Having one of those be non-zero is only essential
when the level being processed is the Plane of Water or Plane of Air.

3 years agofix compatability checking for development
PatR [Sat, 30 Apr 2022 05:37:13 +0000 (22:37 -0700)]
fix compatability checking for development

It is astounding that after all this time no one noticed that
incrementing EDITLEVEL wasn't doing the job it's intended to do.
Diagnosed by entrez:  since VERSION_COMPATIBILITY was defined as
3.7.0-0 and up, increasing the fourth component wasn't resulting in
old 3.7.0-x files being rejected.

This increments EDITLEVEL yet again, because my testing after
commenting out VERSION_COMPATIBILITY still wasn't rejecting older
files.  Proably because the oldest I had available already had the
verison info with the preceding EDITLEVEL so weren't actually out
of date yet.

Once I had old files be rejected, I discovered that the rejection
message was invisible (for tty on OSX).  The message line showed
spaces, matching the length of the intended message, followed by
--More--.  This fixes that too.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Sat, 30 Apr 2022 01:11:10 +0000 (21:11 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agocommand result handling
PatR [Sat, 30 Apr 2022 00:50:26 +0000 (17:50 -0700)]
command result handling

It's possible to get a strange command result of ECMD_CANCEL+ECMD_TIME.
If/when that happens don't just treat it as cancel, make sure that time
elapses.

If an invalid command is provided, clear the do-again queue so that ^A
won't attempt to try the same invalid command again.

3 years agoLua sandbox
nhkeni [Fri, 29 Apr 2022 23:46:33 +0000 (19:46 -0400)]
Lua sandbox

    This is enough to prevent abuse by denying access to functions and
    denial of service (RAM and instruction step limits), but not enough
    to allow restricted use of things that require finer control (e.g.
    filesystem access).

    If something goes wrong, the whole thing can be turned off, for
    now, in config.h (see NHL_SANDBOX).

    None of the current functionality requires changes to build systems;
    some of the possible future functionality may require some #defines
    - TBD.  There is lots of dead code (#ifdef notyet) for bits of that
    additional functionality; we can rip it out if we don't want those
    additions or we can complete (parts of) it depending on our needs.

    All current uses of Lua are connected to sandboxes and guarded with
    nhl_pcall (sandbox and lua_pcall wrapper); options and limits can
    be set at the callsites in the passed nhl_sandbox_info.  Some of
    the error handling may be wrong - panic() vs.  impossible() vs
    silence.

    Memory and instruction step limits should be tuned prior to release;
    there's no point tuning them now.

3 years agobubble/cloud save/restore overhaul
PatR [Fri, 29 Apr 2022 19:44:26 +0000 (12:44 -0700)]
bubble/cloud save/restore overhaul

The air bubbles on the Plane of Water and the clouds on the Plane of
Air were being saved and restored as part of the current level's state
(which is the 'u' struct and invent and such) rather than with the
current level itself.  That was ok for normal play, but for wizard
mode's ^V allowing you to return to a previously visited endgame level
after moving to a different one it meant a new set of bubbles for
Water and new set of clouds for Air.  Even that was ok since it only
applied to wizard mode, but using #wizmakemap to recreate Water or Air
while you were on it added a new set of bubbles or clouds to the
existing ones.  If repeated, eventually there wouldn't be much water
or air left.

Instead of just adding a hack to #wizmakemap, change save/restore to
keep the bubbles/clouds with the level rather than with the state.
That wasn't trivial and now I know why the old odd arrangement was
chosen.  Saving hides u.uz by zeroing it out for levels that the hero
isn't on and it is zero during restore so simple checks for whether a
given level is water or air won't work.

This also adds another non-file/non-debugpline() use of DEBUGFILES:
 DEBUGFILES=seethru nethack -D
will make water and clouds be transparent instead of opaque.  It also
makes fumaroles and other light-blocking gas clouds be transparent
which wasn't really intended, but avoiding it would be extra work that
doesn't accomplish much.

Increments EDITLEVEL for the third time this week....

3 years agoforcefight against edge of map
PatR [Thu, 28 Apr 2022 09:21:46 +0000 (02:21 -0700)]
forcefight against edge of map

Noticed when testing the forcefight against obscured furniture fix:
if you attempted forcefight against the edge of the map, you got
feedback about having already moved as far in <direction> as possible
rather than about forcefight failing to attack anything.  Have the
can't move out bounds test check for forcefight before deciding to
give to its normal feedback.

3 years agofixes entry for pull request #746 - force-fight \
PatR [Thu, 28 Apr 2022 08:33:31 +0000 (01:33 -0700)]
fixes entry for pull request #746 - force-fight \

against "unknown obstacle"

Pull request #746 by entrez:  give better feedback when 'F' prefix
is used toward furniture covered by objects and towards solid rock
terrain on arboreal levels.

Fixes #746

3 years agoFix: force-fight 'unknown obstacle' descriptions
Michael Meyer [Wed, 27 Apr 2022 01:58:51 +0000 (21:58 -0400)]
Fix: force-fight 'unknown obstacle' descriptions

This is intended to address a couple quirks with force-fighting an
unoccupied spot that I noticed:

 * Now that furniture is considered 'solid', an object is much more
   likely to be sitting on the square, obscuring the terrain glyph.  As
   a result, the current glyph is no longer sufficient to accurately
   describe the contents of the spot -- e.g., an altar with a corpse on
   top of it was being described as "an unknown obstacle", even when the
   hero knew exactly what furniture was there.

 * When blind and attacking an unexplored 'solid' square, the attacked
   position would always be described as 'the stone', even something
   like a fountain or sink which didn't seem likely to be confused with
   a stone wall.

 * The feedback for attacking stone was previously changed from 'solid
   rock' to 'stone' in order to be consistent with the feedback for
   attacking an unseen wall, but they still weren't quite the same
   ("stone" vs "the stone").

 * The 'stone' feedback for all STONE/SCORR spots was incorrect on
   levels flagged as arboreal, where stone is rendered and described as
   trees.

This relies on back_to_glyph for positions where the hero is aware of
the terrain and certain other spots (like stone, walls, etc) for which
back_to_glyph produces good results even if they're unseen, and falls
back to the generic "unknown terrain" in other cases.

Pretty long commit message for such a small commit, but oh well...

3 years agoshow trapped doors,chests as themselves \
PatR [Thu, 28 Apr 2022 00:16:23 +0000 (17:16 -0700)]
show trapped doors,chests as themselves \

instead of as fake bear traps

Use the new traps and their tiles when confused gold detection finds
trapped doors and trapped chests.  (Large boxes can be trapped too;
they use the trapped chest trap and corresponding tile rather than
have their own.)

Usually these pseudo-traps go away when as soon as they are within
line of sight.  (While testing, I noticed that seeing a trapped door
from outside its room rather than inside didn't behave that way.
The door was created by wizard mode wishing; I don't know whether
that was a factor.)

I also discovered that secret doors weren't being handled correctly.
They can't be trapped because of their use of both the doormask and
wall_info overlays of levl[][].flags, but I had a secret door be
falsely displayed as a trap.  This fixes that.

We should have obj->tknown and rm->D_TRAPKNOWN so that the hero won't
forget about these traps after declining to attempt to untrap them.
But that's more work than I care to tackle.

3 years agorevisit Qt6 macOS QSoundEffect
nhmall [Wed, 27 Apr 2022 23:06:06 +0000 (19:06 -0400)]
revisit Qt6 macOS QSoundEffect

- After reverting previous related commit, add the QtMultimedia folder to
the include search path as suggested by PatR, and leave qt_bind.cpp alone

3 years agoRevert "Qt6 QSoundEffect on macOS"
nhmall [Wed, 27 Apr 2022 23:00:18 +0000 (19:00 -0400)]
Revert "Qt6 QSoundEffect on macOS"

This reverts commit f6149904c300bf1658d1c04a7d47a86fad77a1de.

3 years agoextra traps followup
PatR [Wed, 27 Apr 2022 22:43:18 +0000 (15:43 -0700)]
extra traps followup

"add glyphs+tiles for door+chest traps",
commit d1217b9f2565a5db7572c7e80c36372115465a1d,
missed a couple of S_vibrating_square references, resulting in
screwed up rendering of zaps and explosions.

3 years agoadd glyphs+tiles for door+chest traps
PatR [Wed, 27 Apr 2022 18:22:12 +0000 (11:22 -0700)]
add glyphs+tiles for door+chest traps

When trap detection finds trapped doors and trapped chests, it shows
those as bear traps.  When the hero comes within view, they revert to
normal and the detected trap is forgotten.  This doesn't change that,
it is just groundwork to be able to show them distinctly.  Like the
TT_BEARTRAP patch, it increments EDITLEVEL so this seemed like a good
time to put the groudwork in place.

There shouldn't be any visible changes even though internal glyph and
tile values have been renumbered after inserting two new entries.
Adding traps after S_vibrating_square was quite a hassle and suffered
though a couple of off-by-one errors that weren't trivial to find and
fix.

3 years agou.utraptype, TT_BEARTRAP
PatR [Wed, 27 Apr 2022 18:04:12 +0000 (11:04 -0700)]
u.utraptype, TT_BEARTRAP

Add 'FIXME' fix by entrez to change TT_BEARTRAP to non-zero.

Increments EDITLEVEL, invalidating existing save and bones files.

3 years agoQt6 QSoundEffect on macOS
nhmall [Wed, 27 Apr 2022 17:56:01 +0000 (13:56 -0400)]
Qt6 QSoundEffect on macOS

3 years agoconsolidate two fixes entries for QSoundEffect
nhmall [Wed, 27 Apr 2022 12:40:02 +0000 (08:40 -0400)]
consolidate two fixes entries for QSoundEffect

3 years agoQt comment update
nhmall [Wed, 27 Apr 2022 11:52:10 +0000 (07:52 -0400)]
Qt comment update

3 years agoadd a fixes note on change from QSound to QSoundEffect
nhmall [Wed, 27 Apr 2022 11:45:43 +0000 (07:45 -0400)]
add a fixes note on change from QSound to QSoundEffect

3 years agoQSoundEffect supported in Qt6 but needs conditional code rework
nhmall [Wed, 27 Apr 2022 11:40:40 +0000 (07:40 -0400)]
QSoundEffect supported in Qt6 but needs conditional code rework

3 years agofix Qt6 broken build
nhmall [Wed, 27 Apr 2022 11:35:31 +0000 (07:35 -0400)]
fix Qt6 broken build

3 years agoWhen setting user sounds, allow also setting a MSGTYPE
Pasi Kallinen [Wed, 27 Apr 2022 10:31:28 +0000 (13:31 +0300)]
When setting user sounds, allow also setting a MSGTYPE

The SOUND lines now have an optional msgtype parameter:

   SOUND=MESG hide "^You miss the " "swing.wav" 75

Fixes #571

3 years agoQt: To play user sounds with volume, replace QSound with QSoundEffect
Pasi Kallinen [Wed, 27 Apr 2022 09:40:53 +0000 (12:40 +0300)]
Qt: To play user sounds with volume, replace QSound with QSoundEffect