]> granicus.if.org Git - nethack/log
nethack
3 years agoFix dlb_main type issues.
nhkeni [Thu, 17 Mar 2022 22:12:40 +0000 (18:12 -0400)]
Fix dlb_main type issues.

3 years agoAdd FITSint() and FITSuint(),
nhkeni [Thu, 17 Mar 2022 22:10:38 +0000 (18:10 -0400)]
Add FITSint() and FITSuint(),
which cast long long to int while panicking on overflow

3 years agoTypedef getloc_flags_t for struct unpacked_coord.getloc_flags and related.
nhkeni [Thu, 17 Mar 2022 21:17:13 +0000 (17:17 -0400)]
Typedef getloc_flags_t for struct unpacked_coord.getloc_flags and related.

3 years agoAdd typedef mmflags_t to assure enough bits for all MM_* flags.
nhkeni [Thu, 17 Mar 2022 21:14:12 +0000 (17:14 -0400)]
Add typedef mmflags_t to assure enough bits for all MM_* flags.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Thu, 17 Mar 2022 20:57:31 +0000 (16:57 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agoGuard variable used only with SYSCF_FILE.
nhkeni [Thu, 10 Mar 2022 21:40:08 +0000 (16:40 -0500)]
Guard variable used only with SYSCF_FILE.

3 years agoMake pointer differenace a long.
nhkeni [Thu, 17 Mar 2022 20:56:25 +0000 (16:56 -0400)]
Make pointer differenace a long.

3 years agoUse lua_Integer when interfacing with lua.
nhkeni [Thu, 17 Mar 2022 20:30:16 +0000 (16:30 -0400)]
Use lua_Integer when interfacing with lua.

3 years agochoosing 'menustyle'
PatR [Thu, 17 Mar 2022 18:33:29 +0000 (11:33 -0700)]
choosing 'menustyle'

When using 'O' to set the menustyle option, include a description of
each of the styles.  Makes the menu entries two lines of two columns
each:  first line contains the setting value and the first half of
its description; second line has blank left column and second half
of description in the right one.  Value on first line and single-line
description on second would have been simpler but this seems easier
to read--the four possible values don't have any clutter between them.

Also, mark the current value as pre-selected.

3 years agoAdd and use Strlen(), like strlen() but panics on unreasonably long strings.
nhkeni [Thu, 17 Mar 2022 01:42:00 +0000 (21:42 -0400)]
Add and use Strlen(), like strlen() but panics on unreasonably long strings.

3 years agoAdd Strlen(), a strlen(3) that panics if string is stupid long and returns unsigned.
nhkeni [Mon, 7 Mar 2022 01:23:04 +0000 (20:23 -0500)]
Add Strlen(), a strlen(3) that panics if string is stupid long and returns unsigned.
First batch of changes to use it to suppress warnings.

3 years agoDon't infringe on POSIX typedef namespace.
nhkeni [Thu, 17 Mar 2022 01:31:26 +0000 (21:31 -0400)]
Don't infringe on POSIX typedef namespace.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Thu, 17 Mar 2022 01:27:22 +0000 (21:27 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agossize_t for Windows
nhkeni [Thu, 17 Mar 2022 01:27:06 +0000 (21:27 -0400)]
ssize_t for Windows

3 years agotty: count for group accelerators
PatR [Thu, 17 Mar 2022 00:03:52 +0000 (17:03 -0700)]
tty: count for group accelerators

github issue #697 from copperwater points out that using a menu for
pickup and attempting to give a count to pickup a subset of gold was
ignoring the count and picking up all gold.  That was an unintended
side-effect of making '$' be a group accelerator for gold in addition
to being the 'letter' for a stack of gold (so that it can be chosen
even when not displayed on the current page, the way other groups
behave).

Picking groups via their accelerator ignored any pending count (in
tty; curses seems to apply the count).  Change tty to apply a pending
count to all menu entries that get toggled on via group accelerator.
It's intended to address the gold bug but might also be used to
select one from every potion stack via '1!', for example.  (Seems to
be of very limited functionality, but that was more straightforward
than singling out gold's group to behave differently.)

While in there, change how tty uses menuitem_invert_test():  call it
for set-page/set-all/unset-page/unset-all in addition to existing
invert-page/invert-all.  unset-page/unset-all won't actually be
affected unless 'menuinvertmode' option is set to 2.

Closes #697

3 years agomenuinvertmode
PatR [Wed, 16 Mar 2022 23:19:30 +0000 (16:19 -0700)]
menuinvertmode

Change the 'menuinvertmode' default from 0 to 1 so that it gets more
exercise.  It can be changed back to 0 via option settings but it's
doubtful that anyone will care enough to bother.

Some pickup/take-off actions have been using it to avoid setting
their 'all' choice when bulk toggling for current-page or whole-menu
takes place; 'O' specifies it for its '?' help choice.  This adds
the skipinvert flag to the 'all' choice of #wizidentify.

The comments describing it now state that menuinvertmode applies to
bulk set-on operations as well as to toggle-on/off operations but
that will only be true if/when interfaces call menuitem_invert_test()
for set as well as for invert.  tty is about to start doing that.

3 years agoAdd streq() and start finding places it fixes warnings.
nhkeni [Wed, 16 Mar 2022 22:50:17 +0000 (18:50 -0400)]
Add streq() and start finding places it fixes warnings.
Some type fixes from Michael Allison.

3 years agoMake readLenType generally available. Fix some warnings around read(2).
nhkeni [Wed, 16 Mar 2022 22:41:45 +0000 (18:41 -0400)]
Make readLenType generally available.  Fix some warnings around read(2).

3 years agoVarious type and cast bits.
nhkeni [Wed, 16 Mar 2022 22:18:52 +0000 (18:18 -0400)]
Various type and cast bits.

3 years agoLIMIT_TO_RANGE_INT macro and various casts.
nhkeni [Wed, 16 Mar 2022 21:59:23 +0000 (17:59 -0400)]
LIMIT_TO_RANGE_INT macro and various casts.

3 years agoSome easy loss-of-precision fixes.
nhkeni [Wed, 16 Mar 2022 21:49:29 +0000 (17:49 -0400)]
Some easy loss-of-precision fixes.

3 years agocmdcount_t
nhkeni [Mon, 28 Feb 2022 00:57:16 +0000 (19:57 -0500)]
cmdcount_t

Add a type to force g.{command_count,last_command_count,multi} to have the
same type (because cmd.c: g.multi = g.command_count;) and some resulting
cleanup.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Wed, 16 Mar 2022 21:22:43 +0000 (17:22 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agoxcode cleanup:
nhkeni [Sun, 20 Feb 2022 01:50:10 +0000 (20:50 -0500)]
xcode cleanup:
 don't use git (so tarball distribution should work)
 name the build shell scripts

3 years agoFix xcode recover install
nhkeni [Tue, 1 Mar 2022 14:10:17 +0000 (09:10 -0500)]
Fix xcode recover install

3 years agoNetHack.xcodeproj: update handling of Lua
nhkeni [Mon, 14 Feb 2022 00:06:51 +0000 (19:06 -0500)]
NetHack.xcodeproj: update handling of Lua

3 years agoChange map terrain changing from macro to function
Pasi Kallinen [Wed, 16 Mar 2022 18:59:55 +0000 (20:59 +0200)]
Change map terrain changing from macro to function

The function handles setting lava lit, and removing ice melt timers.

3 years agoLua: allow calling impossible
Pasi Kallinen [Wed, 16 Mar 2022 14:58:42 +0000 (16:58 +0200)]
Lua: allow calling impossible

3 years agoRemove melting ice timeouts when terrain changes
Pasi Kallinen [Wed, 16 Mar 2022 14:51:53 +0000 (16:51 +0200)]
Remove melting ice timeouts when terrain changes

If special level lua code creates a melting ice timeout, but
later in the code places stairs, or a trap which might change
the ice to room floor, the timer sanity checking doesn't
like that.

3 years agoSimplify abscoord code
Pasi Kallinen [Wed, 16 Mar 2022 14:46:06 +0000 (16:46 +0200)]
Simplify abscoord code

No need to call get_location_coord, as we're never dealing with
random coordinates or rooms.

3 years agoUnhide monster when rolling boulder explodes
Pasi Kallinen [Wed, 16 Mar 2022 14:43:42 +0000 (16:43 +0200)]
Unhide monster when rolling boulder explodes

3 years agoFix: levitating/flying monsters moving over liquid
Michael Meyer [Tue, 15 Mar 2022 22:28:46 +0000 (18:28 -0400)]
Fix: levitating/flying monsters moving over liquid

Commit c1a6dd4 was meant to prevent flying, levitating, and clinging
monsters from considering walls of water as acceptable movement
destinations, even outside of the Plane of Water.  However, it was
evaluating the monster's starting position instead of possible places to
move to, and the evaluation was 'backwards' (the equivalent of
IS_WATERWALL, instead of !IS_WATERWALL).

The result was that non-swimming monsters could only move onto any kind
of water or lava square if the position they were moving from was a
WATER square.  Change this so that instead of the starting position,
each potential destination spot's status as a wall of water is evaluated
in turn, and reverse the effect of the test so that it blocks walls of
water instead of allowing them.

3 years agoLua: ice theme room and melting ice
Pasi Kallinen [Tue, 15 Mar 2022 20:05:32 +0000 (22:05 +0200)]
Lua: ice theme room and melting ice

Allow the ice theme room to occasionally have melting ice.
Add nh.abscoord() to convert room-relative to map-absolute coords.

3 years agoLua: allow obj chain iteration
Pasi Kallinen [Tue, 15 Mar 2022 16:24:49 +0000 (18:24 +0200)]
Lua: allow obj chain iteration

3 years agoDocument the lua object class
Pasi Kallinen [Tue, 15 Mar 2022 12:17:46 +0000 (14:17 +0200)]
Document the lua object class

3 years agoLua: location-specific timers
Pasi Kallinen [Tue, 15 Mar 2022 11:46:50 +0000 (13:46 +0200)]
Lua: location-specific timers

Expose map-location specific timers to lua scripts. For example:

  nh.start_timer_at(x,y, "melt-ice", 10);

Currently only available timer type is "melt-ice".

3 years agoFix autowielding tools taking no time
Pasi Kallinen [Tue, 15 Mar 2022 09:34:45 +0000 (11:34 +0200)]
Fix autowielding tools taking no time

When applying some tools (whips, polearms, grapples), or rubbing
a lamp, or when fireassist is on and you fire something without
wielded launcher, the automatic wielding should take as much time
as wielding the item normally does.

Fixes #696

3 years agoFix selection "random" grow direction, and other code cleanup
copperwater [Tue, 15 Mar 2022 00:54:23 +0000 (20:54 -0400)]
Fix selection "random" grow direction, and other code cleanup

Noticed that when I set a selection to grow in a random direction, it
instead grew in all directions, which is not what I wanted. Turns out
the -1 random dir ended up being passed straight to the code which
checks bitmasks, without any form of randomizing among directions.

So this adds code to do that, and defines W_RANDOM as -1 rather than
using a magic number. In the process I also noticed that specifying
"random" as the wall for a door in a room made it rerandomize the
direction every iteration of its loop, essentially rolling two rn2(4)s
and only proceeding if they matched. That was pointless so I cleaned it
up a bit.

Also added safety checks in the form of an impossible for des.corridor()
being called with "random" as either walldir, because this is not
implemented currently.

And lastly, I noticed that create_secret_door was entirely unused
(secret door creation is handled in create_door), so I deleted it.

The only behavior change caused by this is that the Valkyrie quest lava
pools will be a little smaller, which is the only place grow is
currently used. If it's desired to keep them the same, that should be
changed to "all".

3 years agoReduce eucalyptus leaf nutrition to 1
copperwater [Mon, 14 Mar 2022 14:11:07 +0000 (10:11 -0400)]
Reduce eucalyptus leaf nutrition to 1

Eucalyptus leaves are famously inedible except by certain animals such
as koalas. I consider it very strange that a single leaf in NetHack
gives you six meatballs' worth of calories.

I considered making it 0 nutrition, but am not sure if a 0-nutrition
comestible would end up violating some assumption that all food is at
least 1 nutrition.

3 years agoAdd test for selection subtraction
Pasi Kallinen [Mon, 14 Mar 2022 17:06:07 +0000 (19:06 +0200)]
Add test for selection subtraction

3 years agoImplement selection addition and difference
copperwater [Mon, 14 Mar 2022 15:14:46 +0000 (11:14 -0400)]
Implement selection addition and difference

Selection difference is something I have found myself wanting a lot when
working on levels, and have had to defer to a clunkier xor-then-and
approach. This commit implements the TODO-ed addition and subtraction
operators on two sets.

I don't see how the addition operator would be any different from
logical or, so it just calls l_selection_or rather than implement a new
function.

3 years agoExternify trycall() and replace many docall() calls with it
copperwater [Sun, 23 May 2021 00:46:03 +0000 (20:46 -0400)]
Externify trycall() and replace many docall() calls with it

trycall() is a short docall() wrapper that is a no-op if the item is
already identified or the player has called the object type already. For
some reason, many calls to docall() did those same exact checks
beforehand.

This commit eliminates that redundancy by converting those calls into
trycall(), which is now made extern rather than local to do.c. No
behavior should be changed by this commit; I've checked that none of the
affected places could take a different code path now that the
oc_name_known and oc_uname checks are removed.

3 years agoFix potentially uninitialized variables
Pasi Kallinen [Mon, 14 Mar 2022 08:06:23 +0000 (10:06 +0200)]
Fix potentially uninitialized variables

3 years agoWindows nmake build - separate x86 and x64 objs
nhmall [Mon, 14 Mar 2022 01:17:08 +0000 (21:17 -0400)]
Windows nmake build - separate x86 and x64 objs

3 years agorevise a couple of recent changes
PatR [Sun, 13 Mar 2022 20:58:56 +0000 (13:58 -0700)]
revise a couple of recent changes

include/.gitignore should continue to ignore old files in case
someone checks out an older version, builds, then checks out the
current version without running 'make spotless' first.

sys/unix/Makefile.utl:  tiletxt.o depends on tilemap.c in addition
to tiletxt.c.

3 years agoLua: object bury method
Pasi Kallinen [Sun, 13 Mar 2022 16:38:23 +0000 (18:38 +0200)]
Lua: object bury method

3 years agoremove a commented out test line from Makefile.utl
nhmall [Sun, 13 Mar 2022 15:37:00 +0000 (11:37 -0400)]
remove a commented out test line from Makefile.utl

3 years agoThis is cron-daily v1-Feb-22-2022. 000files updated: Files
nhw_cron [Sun, 13 Mar 2022 15:24:08 +0000 (11:24 -0400)]
This is cron-daily v1-Feb-22-2022.  000files updated: Files

3 years agofollow-up: missed one include/tile.h
nhmall [Sun, 13 Mar 2022 15:24:19 +0000 (11:24 -0400)]
follow-up: missed one include/tile.h

3 years agoupdate include/.gitinfo
nhmall [Sun, 13 Mar 2022 15:17:58 +0000 (11:17 -0400)]
update include/.gitinfo

3 years agosome parallel Make glitches noticed
nhmall [Sun, 13 Mar 2022 15:06:45 +0000 (11:06 -0400)]
some parallel Make glitches noticed

observed: parallel build attempts of makedefs that trampled over
one another.

attempted workaround: Add a dependency as per Pat R's suggestion.

observed: Concurrent header file movement collisions were sometimes
causing file busy errors and build failures.

workaround: Eliminate tile.h header file movement from the
Makefile build so that the collisions won't occur with that
particular file. Leave the header file tile.h in win/share as it
is in the distribution and just adjust the include path in the
rule for the specific files that use it.

observed: tiletxt.c created on-the-fly from Makefile echo statements
sometimes resulted in garbled and duplicate content in it when
parallel makes were involved, and that caused a build failure.

workaround: Instead of creating a tiletxt.c on-the-fly via echo
statements in the Makefile, simplify things and use that
same #include "tilemap.c" approach but make it an actual file
in the distribution. That makes it available for other platforms
too.

3 years agoWindows visual studio project updates
nhmall [Sun, 13 Mar 2022 14:20:41 +0000 (10:20 -0400)]
Windows visual studio project updates

hide a couple of warnings in non-nethack code
get rid of an obsolete file reference

3 years agoLua: object timers
Pasi Kallinen [Sun, 13 Mar 2022 12:29:32 +0000 (14:29 +0200)]
Lua: object timers

Expose object timers to lua scripts. For example:

   local o = obj.new("cockatrice egg");
   o:placeobj(5, 5);
   o:start_timer("hatch-egg", 3);

Available methods are:

- obj.has_timer("rot-corpse")
    returns true if object has attached timer, false otherwise.

- obj.peek_timer("hatch-egg")
    returns an integer value, which is the turn when the timer
    attached to the object would trigger. returns 0 if no such timer.

- obj.stop_timer("shrink-glob")
    stops attached timer, or if no timer type is given, stops all
    timers attached to the object.

- obj.start_timer("zombify-mon", 15)
    starts a timer with a trigger time in that many turns in the future.
    replaces any previous timer of the same type.

Valid timers are "rot-organic", "rot-corpse", "revive-mon",
"zombify-mon", "burn-obj", "hatch-egg", "fig-transform",
and "shrink-glob". Also "melt-ice" is recognized, but does nothing
to objects.

3 years agowarning fix artifact.c
nhmall [Sun, 13 Mar 2022 02:49:32 +0000 (21:49 -0500)]
warning fix artifact.c

artifact.c: In function 'dump_artifact_info':
artifact.c:1088:37: warning: '%s' directive writing up to 255 bytes into a region of size 218 [-Wformat-overflow=]
 1088 |             Sprintf(buf, "  %-36.36s%s", artiname(m), buf2);
      |                                     ^~                ~~~~
In file included from ../include/config.h:652,
                 from ../include/hack.h:10,
                 from artifact.c:6:
../include/global.h:255:24: note: 'sprintf' output between 39 and 294 bytes into a destination of size 256
  255 | #define Sprintf (void) sprintf
artifact.c:1088:13: note: in expansion of macro 'Sprintf'
 1088 |             Sprintf(buf, "  %-36.36s%s", artiname(m), buf2);
      |             ^~~~~~~

3 years agoartifact tracking again
PatR [Sun, 13 Mar 2022 01:25:54 +0000 (17:25 -0800)]
artifact tracking again

Redo the recent artifact creation stuff by replacing several nearly
identical routines with one more general one.  Also adds a tracking
bit for one or two more creation methods.  That changed artiexist[]
from an array of structs holding 8 or less bits to one holding 9, so
bump EDITLEVEL in case the total size changed.

3 years agolivelog of breaking food conducts
PatR [Sun, 13 Mar 2022 01:07:28 +0000 (17:07 -0800)]
livelog of breaking food conducts

Shorten the livelog messages for food conduct a little by changing a
bunch of "the first time" to just "first time".  Will result in fewer
instances of tty condensing whitespace for a too-wide line written
into a text window.  That includes stripping off indentation, which
messes up the alignment of #chronicle output.

Also, eliminate one redundant livelog printf.  Breaking vegan conduct
by eating wax when poly'd can be folded into same message for eating
leather/bones/dragon hide.  [The breaking vegetarian conduct for those
says "eating meat" which seems wrong but hasn't been changed.]

3 years agoRolling boulder launch coordinates
Pasi Kallinen [Sat, 12 Mar 2022 16:34:40 +0000 (18:34 +0200)]
Rolling boulder launch coordinates

Allow defining rolling boulder launching location in special level
lua scripts:

 des.trap({ type="rolling boulder", coord={7, 5}, launchfrom={-2, -2} });

launchfrom is relative to the trap coord.

3 years agoSeparate function for finding random launch coordinate
Pasi Kallinen [Sat, 12 Mar 2022 16:04:29 +0000 (18:04 +0200)]
Separate function for finding random launch coordinate

3 years agomore artifact tracking
PatR [Fri, 11 Mar 2022 19:00:44 +0000 (11:00 -0800)]
more artifact tracking

This should have been broken up into multiple pieces but they're
all lumped together.  I did ultimately throw away a fourth change.

Implement artiexist[].bones and artiexist[].rndm artifact creation
tracking bits that were added recently.  Doesn't need to increment
EDITLEVEL this time.

Add a new wizard mode feature:  if you use `a to show discovered
artifacts, it will prompt about whether to show the tracking bits
for all artifacts instead.  If not using menustyle traditional,
you need at least one artifact to have been discovered in order to
have 'a' choice available when selecting what class of discovered
objects to show for the '`' command.

artifact_gift(), aritfact_wish(), and so forth return a value that
none of the existing callers use, so cast their calls to (void).

3 years agogithub PR #694 - redundant null check
PatR [Fri, 11 Mar 2022 17:58:40 +0000 (09:58 -0800)]
github PR #694 - redundant null check

Pull request from argrath:  a check for null trap in untrap_prob()
comes after an unconditional use of that trap so doesn't server any
useful purpose.

Redo a couple of comments too.  No fixes entry necessary.

Closes #694

3 years agoremove redundant null-check on untrap_prob()
SHIRAKATA Kentaro [Tue, 8 Feb 2022 20:50:49 +0000 (05:50 +0900)]
remove redundant null-check on untrap_prob()

`ttmp` should not be NULL here, otherwise this function will crash at earlier code.

3 years agoUnhide monster hiding under shrinking glob
Pasi Kallinen [Fri, 11 Mar 2022 15:34:06 +0000 (17:34 +0200)]
Unhide monster hiding under shrinking glob

3 years agomissed band for windows Makefile.msc
nhmall [Fri, 11 Mar 2022 12:51:12 +0000 (07:51 -0500)]
missed band for windows Makefile.msc

3 years agoheader file ordering change
nhmall [Fri, 11 Mar 2022 12:33:28 +0000 (07:33 -0500)]
header file ordering change

This is groundwork for some other changes.

Include integer.h ahead of global.h in config.h.

3 years agodiscovered objects within class for a and u
PatR [Thu, 10 Mar 2022 22:57:15 +0000 (14:57 -0800)]
discovered objects within class for a and u

If any artifacts are discovered and menustyle traditional is in use,
the player can type `a to get the artifact subset of discovered items.
Likewise with `u to for unique items (the invocation tools and the
real Amulet).  For normal object classes, `<class> works for every
class, even when there aren't any discoveries for it (where you get
told "you haven't discovered any yet" if you pick such).  But `a
and `u were only allowed if at least one thing in the corresponding
category had been discovered.  Change to allow it even when none have
been.  The feedback of "you haven't discovered any {unique items,
artifacts} yet" was already in place.

Doesn't apply for picking the class via menu.  Menus don't have any
concept of "allowed as a response even though not listed as a choice".

3 years agowarning fix artifact.c
nhmall [Thu, 10 Mar 2022 14:15:04 +0000 (09:15 -0500)]
warning fix artifact.c

src/artifact.c(65): warning C4132: 'zero_artiexist': const object
should be initialized

3 years agoMerge branch 'pr693' into NetHack-3.7
nhmall [Thu, 10 Mar 2022 14:10:05 +0000 (09:10 -0500)]
Merge branch 'pr693' into NetHack-3.7

3 years agoMerge branch 'fix-splev' of https://github.com/argrath/NetHack into pr693
nhmall [Thu, 10 Mar 2022 14:09:33 +0000 (09:09 -0500)]
Merge branch 'fix-splev' of https://github.com/argrath/NetHack into pr693

3 years agokeep track of how artifacts got created
PatR [Thu, 10 Mar 2022 00:11:14 +0000 (16:11 -0800)]
keep track of how artifacts got created

Since the struct used for elements of artiexist[] has a lot of unused
bits, add some new ones to extend it to indicate how artifacts have
been created.  It had
| .exists (has been created) and
| .found (hero is aware that it has been created)
introduce
| .gift (divine gift),
| .wish (player wish),
| .named (naming elven weapon Sting or Orcrist)
| .viadip (made Excalibur by dipping long sword into fountain)
| .rndm (randomly created), and
| .bones (from bones file--how it got created in earlier game isn't
tracked).  The first four are implemented, fifth and sixth aren't.

Some of the feedback when receiving an artifact or spellbook has been
revised.

When artiexist[] was changed from an array of booleans to an array of
structs a couple of days ago, EDITLEVEL should have been incremented
but I overlooked that at the time.  This commit does so now.

3 years agoadd explicit cast on somexy() call
SHIRAKATA Kentaro [Sat, 26 Feb 2022 18:50:01 +0000 (03:50 +0900)]
add explicit cast on somexy() call

All other somexy() calls not using a return value have a cast.

3 years agoThis is cron-daily v1-Feb-22-2022. 000files updated: Files
nhw_cron [Wed, 9 Mar 2022 17:24:08 +0000 (12:24 -0500)]
This is cron-daily v1-Feb-22-2022.  000files updated: Files

3 years agosome sys/windows build updates
nhmall [Wed, 9 Mar 2022 17:02:37 +0000 (12:02 -0500)]
some sys/windows build updates

Place built libraries for Lua and pdcurses into lib instead of the
more transient src/o subfolder.

Remove a kludge involving sys/windows/stub-pdcscrn.c.

Don't link pdcurses into NetHackW.exe (required a couple of stubs
since NetHack.exe and NetHackW.exe currently share object files
under the visual studio nmake build.

(Note: This may require a couple of follow-on minor modifications
to the mingw build. If so, the CI will flag that for us after this
commit)

3 years agodivine gift of spell knowledge
PatR [Wed, 9 Mar 2022 15:06:37 +0000 (07:06 -0800)]
divine gift of spell knowledge

Remove the conduct-specific aspect of receiving spells as prayer boon.
Anyone now has a 25% chance of having the spell directly implanted
into their head, not just characters who have maintained illiterate
conduct.  It can now also restore a forgotten spell or refresh one
that is nearly forgotten.  It still tries to choose a spell which
isn't already known (new: or was known but has been forgotten) but if
it picks one that is known and doesn't need refreshing, a redundant
book will be given, same as the behavior in earlier versions.

The chance for receiving a blank spellbook is higher when that item
is undiscovered.  When given as a prayer reward, make it become
discovered even if hero doesn't read it so that it will be less likely
to be given again.  There's a 1% chance for that auto-discovery to
happen with other bestowed books.  Unlike blank boots, having the book
be discovered doesn't lessen their chance of being repeat gifts.

Minor bug fix:  for a spell implanted from scratch, the book remains
unknown.  That's ok; it's actually more interesting than discovering
a book you haven't seen yet.  But after acquiring and reading the book
you could get "you know <spell> quite well already" and the book would
stay undiscovered even though you were just told what spell it's for.

3 years agofix github issue #691 - non-lawful Angels \
PatR [Mon, 7 Mar 2022 23:12:12 +0000 (15:12 -0800)]
fix github issue #691 - non-lawful Angels \

get lawful artifacts

Reported by vultur-cadens, Angels can be given Sunsword or Demonbane
for starting equipment even when they aren't lawful so won't attempt
to use those.

This should fix it but it's a pain to test.

Closes #691

3 years agofixes3-7-0 entry for PR #692, typos in dat/tribute
PatR [Mon, 7 Mar 2022 22:38:26 +0000 (14:38 -0800)]
fixes3-7-0 entry for PR #692, typos in dat/tribute

Pull request #692 from zomGreg.  One comment misspells "transcription"
and Death quote #29 coming from Reaper Man misspells "metaphor".  Fixed
by separate commits.

Closes #692

3 years agocorrected spelling of transcription
zomgreg [Mon, 7 Mar 2022 02:55:17 +0000 (19:55 -0700)]
corrected spelling of transcription

3 years agocorrected spelling of metaphor
zomgreg [Mon, 7 Mar 2022 02:44:16 +0000 (19:44 -0700)]
corrected spelling of metaphor

3 years agomore artifact tracking
PatR [Mon, 7 Mar 2022 21:21:17 +0000 (13:21 -0800)]
more artifact tracking

Move some code that was used to decide whether to call distant_name
or doname into distant_name so that the places which were doing that
don't need to anymore and fewer places can care about whether an
artifact is being found.  There were two or three instances of
distant_name maybe being called, based on distance from hero, and
yesterday's artifact livelog change added two or three more and made
all of them override the distance limit for artifacts.

After that change to distant_name, make sure that conditional calls
to it become unconditional--just not displayed for the cases where
!flags.verbose had been excluding them.  That way distant_name can
decide whether an item is up close and arrange for xname to find it
if it as an artifact.

Also, implement an old TODO.  Wearing the Eyes of the Overworld
extends the distance that an item can be from the hero and still be
considered near anough to be seen "up close" when monsters pick it
up or drop it.  The explicit cases were using distu(x,y) <= 5, the
distance of a knight's jump.  Each quadrant around the hero is a 2x2
square with the diagonal corner chopped off.  The replacement code in
distant_name calculates a value of 6, which is functionally equivalent
since the next value of interest beyond 5 is 8.  Wearing the Eyes
(deduced by having Xray vision) extends that threshold an extra step
in addition to overriding blindness and seeing through walls:  15,
a 3x3 square in each quadrant, still with the far diagonal corner (16)
treated as out of range.

3 years agoWindows nmake build fix
nhmall [Mon, 7 Mar 2022 12:35:35 +0000 (07:35 -0500)]
Windows nmake build fix

3 years agolivelog event for finding artifacts
PatR [Mon, 7 Mar 2022 11:33:01 +0000 (03:33 -0800)]
livelog event for finding artifacts

Log artifacts found on the floor, or carried by monsters if hero sees
those monsters do something with them.  Shown to player via #chronicle
and included in dumplog.

For most cases, finding is based on having the artifact object be
formatted for display.  So walking across one won't notice it if pile
size inhibits showing items at its location, even if the artifact is
on top.  Taking stuff out of a container won't notice an artifact if a
subset of the contents chosen by class or BUCX filter doesn't include
it unless player has used ':' to look inside.  Seeing an artifact be
picked up by a monster (even if the monster itself is unseen) or being
dropped (possibly upon death) will find an artifact even if beyond the
normal range of having it be treated as seen up close.  Random treasure
drop items are excluded since they are placed directly on the floor
rather than going into a dying monster's inventory and then dropped
with its other stuff.

3 years agofound_artifact() groundwork
PatR [Mon, 7 Mar 2022 10:06:55 +0000 (02:06 -0800)]
found_artifact() groundwork

Lay groundwork for generating a log event when finding an artifact
on the floor or carried by a monster.  This part should not produce
any change in behavior.

Move g.artidisco[] and g.artiexist[] out of the instance_globals
struct back to local within artifact.c.  They are both initialized
at the start of a game (and only used in that file) so don't need
to be part of any bulk reinitialization if restart-instead-of-exit
ever gets implemented.

Convert artiexist[] from an array of booleans to an array of structs
containing a pair of bitfields.  artiexist[].exists is a direct
replacement for the boolean; artiexist[].found is new but not put to
any significant use yet.  If will be used to suppress the future
found-an-artifact event for cases where a more specific event (like
crowning or divine gift as #offer reward) is already produced.

Remove g.via_naming altogether and add an extra argument to oname()
calls to replace it.

Add an extra argument to artifact_exists() calls.

3 years agolivelog event for crowning gift
PatR [Sat, 5 Mar 2022 23:14:18 +0000 (15:14 -0800)]
livelog event for crowning gift

There is an event for being crowned "Hand of Elebereth" and so forth
and an event for being given an artifact (any, not just the first) as
reward for #offer, but there wasn't one for the item usually given
along with being crowned.

Now there is.  It's not something that an observer (of the events
being logged) can deduce since sometimes an alternative is given
(wizard and monk) and other times nothing is given (artifact already
exists or lawful character isn't wielding non-artifact long sword).

I flagged the spellbook given to a wizard or a monk as
'divinegift | artifact | spoiler'.  'artifact' since even though it
isn't actually an artifact, it is standing in the place for one.  And
'spoiler', to hide from #chronicle, in case the hero doesn't know the
spellbook yet.

3 years agoCan't swallow trapped monsters
Pasi Kallinen [Sat, 5 Mar 2022 16:30:30 +0000 (18:30 +0200)]
Can't swallow trapped monsters

Gulping can move the trapped monster to another location, while
still being marked as trapped.  I don't want to deal with this,
so just say purple worms can't swallow trapped monsters...

3 years agoIlliterate and blank spellbooks from gods
Pasi Kallinen [Sat, 5 Mar 2022 14:42:42 +0000 (16:42 +0200)]
Illiterate and blank spellbooks from gods

Make gods avoid giving blank spellbooks as gifts, if you're
illiterate.  But if you do get a blank spellbook as a gift,
don't force-learn that non-existent spell.

3 years agoReset next_boulder when boulder was pushed
Pasi Kallinen [Sat, 5 Mar 2022 14:36:26 +0000 (16:36 +0200)]
Reset next_boulder when boulder was pushed

3 years agoGet out of moverock correctly, so we clear next_boulder
Pasi Kallinen [Sat, 5 Mar 2022 13:46:16 +0000 (15:46 +0200)]
Get out of moverock correctly, so we clear next_boulder

3 years agoFix monster trapped in nonexistent trap, pt 2
Pasi Kallinen [Sat, 5 Mar 2022 11:42:24 +0000 (13:42 +0200)]
Fix monster trapped in nonexistent trap, pt 2

Monster hiding under an item on a location with a land mine,
a rolling boulder trap launches a boulder which blows up the mine,
and all the items scatter away. If the hider survived that, it
was still hiding.

3 years agoFix monster trapped in nonexistent trap
Pasi Kallinen [Sat, 5 Mar 2022 09:26:39 +0000 (11:26 +0200)]
Fix monster trapped in nonexistent trap

A monster trapped in a bear trap on ice, exploding fiery monster
turned the ice into water turning the trap into object, the trapped
monster claimed to be still trapped in the nonexistent trap.

3 years agoll_achieve_msg.llflag
PatR [Sat, 5 Mar 2022 08:31:36 +0000 (00:31 -0800)]
ll_achieve_msg.llflag

Fix another type mismatch with the livelog code; make the flags field
in ll_achieve_msg match the one in gavelog_line.

3 years agoFix segfault with uball
Pasi Kallinen [Sat, 5 Mar 2022 08:06:01 +0000 (10:06 +0200)]
Fix segfault with uball

Drowning in a pool while punished and carrying the ball,
and the only available space to crawl back on dry land
has a magic trap, which unpunishes you.

3 years agoEDITLEVEL increment
PatR [Sat, 5 Mar 2022 03:39:45 +0000 (19:39 -0800)]
EDITLEVEL increment

The change to report which item was acquired in the logged event for
Sokoban completion changed the context struct so changed the contents
of save files but neglected to update EDITLEVEL to reject old save
files.  Do so now.

3 years agolivelog tweaks, mostly sokoban
PatR [Fri, 4 Mar 2022 21:07:14 +0000 (13:07 -0800)]
livelog tweaks, mostly sokoban

Demote "completed sokoban {1,2,3,4}" from major achievement to minor
at the request of hardfought.  OR on the 'dump' flag so that those
entries appear in dumplog.

Change "completed Sokoban" (for the whole branch) to "acquired the
Sokoban <prize object>" since that's what triggers the event and it
is possible to pass through the first level without completing that.
This event is still classified as a major achievement.  It has has
the 'spoiler' flag added to prevent #chronicle from showing that event
which now discloses the type of item the prize is.  (Note: suppression
of spoiler events is ignored in wizard mode.)

The "attained rank N" achievements are classified as minor for ranks
1..3 (gaining levels 3, 6, 10); OR the 'dump' flag for those.  [Rank 0
for levels 1 and 2 isn't an achievement and 4..8 for Xp levels 14, 18,
22, 26, and 30 are classified as 'major' achievements so don't need
that flag to make it into dumplog.]

3 years agoFix couple cases of unhiding monsters
Pasi Kallinen [Fri, 4 Mar 2022 17:58:17 +0000 (19:58 +0200)]
Fix couple cases of unhiding monsters

Hidden monster might be forced to move to a location where it
can't hide, perhaps because it's mostly surrounded by other monsters.

Hidden monster in a pit under items, getting hit by a rolling boulder,
the boulder will fill the pit burying the items, making the monster
unable to hide there.

3 years agoMore trap sanity
Pasi Kallinen [Fri, 4 Mar 2022 15:18:05 +0000 (17:18 +0200)]
More trap sanity

3 years agoTrap sanity checking
Pasi Kallinen [Fri, 4 Mar 2022 14:54:26 +0000 (16:54 +0200)]
Trap sanity checking

3 years agoGuidebook tweaks (mainly DUMPLOG)
PatR [Fri, 4 Mar 2022 14:51:40 +0000 (06:51 -0800)]
Guidebook tweaks (mainly DUMPLOG)

In the sysconf section, "the following options affect the score file:"
had some score options and then several non-score options.  Change to
"following four options" which reads a little strange but is precise.
Some other inserted line after those four options describing what
follows would read better but the stuff that follows is essentially
random based on the order that support for them was implemented.

Guidebook.mn:  the 'placeholders' for DUMPLOG file name substitution
had the description column line up but the proportional font for the
'%x' column looked bad.  Force fixed-width font there.  Also add some
indentation.  I wasn't sure whether '.in' should in inside .PS ... .PE
or outside.  The final result looks the same either way.

Guidebook.tex:  the new LIVELOG entry was accidentally placed after
the \elist line when it should come before that.  (Not tested.)

3 years agoFix checking monster moving into a trap return value
Pasi Kallinen [Fri, 4 Mar 2022 14:42:11 +0000 (16:42 +0200)]
Fix checking monster moving into a trap return value

When I added a new trap return value, this was one place that
should've checked it.

This was really annoying to debug - it manifested as a temp level
file loading error, because a monster moved on to a level teleport
trap, which zeroes out (mx, my), then later in the monster movement,
a web spinner created a web at (0,0), and then hero leaving the level,
the traps were saved into the level file ... and when loaded, the code
thought a trap with x == 0 meant there were no more traps.

3 years agomention sysconf entry LIVELOG in Guidebook
PatR [Fri, 4 Mar 2022 14:02:32 +0000 (06:02 -0800)]
mention sysconf entry LIVELOG in Guidebook

It's description is minimal since it isn't relevant to most people,
even ones playing on servers who have live-logging enabled.

3 years agoUnhide monster when boulder rolls away
Pasi Kallinen [Fri, 4 Mar 2022 08:48:38 +0000 (10:48 +0200)]
Unhide monster when boulder rolls away

3 years agoPrevent monster hurtling outside map
Pasi Kallinen [Thu, 3 Mar 2022 20:23:25 +0000 (22:23 +0200)]
Prevent monster hurtling outside map