]> granicus.if.org Git - nethack/log
nethack
3 years agoWindows Makefile.gcc dependency update
nhmall [Tue, 14 Sep 2021 16:36:29 +0000 (12:36 -0400)]
Windows Makefile.gcc dependency update

Copy the recently updated dependencies from sys/unix/Makefile.src
over to sys/windows/Makefile.gcc.

3 years agoWindows Makefile.msc dependency update
nhmall [Tue, 14 Sep 2021 14:25:49 +0000 (10:25 -0400)]
Windows Makefile.msc dependency update

Copy the recently updated dependencies from sys/unix/Makefile.src
over to sys/windows/Makefile.msc.

3 years agoUnix 'make depend'
PatR [Tue, 14 Sep 2021 09:06:14 +0000 (02:06 -0700)]
Unix 'make depend'

I recently changed a comment in objclass.h and that should have
triggered a full or nearly full rebuild but only resulted in a
couple of files being recompiled.  Instead of trying to figure out
why, I just ran Makefile.src through 'make depend' to force it to
be up to date.

A side-effect is that version.c won't be unnecessarily recompiled
every time nethack gets relinked.  The reason for that (date.h
being regenerated with new data) is handled by date.c now.

3 years agowindows visual studio project build tweaks
nhmall [Mon, 13 Sep 2021 15:32:59 +0000 (11:32 -0400)]
windows visual studio project build tweaks

3 years agoremove sp_lev execute bits
Pasi Kallinen [Sun, 12 Sep 2021 19:34:19 +0000 (22:34 +0300)]
remove sp_lev execute bits

3 years agoReveal the monster your strike moved
Pasi Kallinen [Sun, 12 Sep 2021 16:44:35 +0000 (19:44 +0300)]
Reveal the monster your strike moved

When you hit a small hidden monster (by eg. force-fighting)
that got moved by the strike, the monster stayed hidden, possibly
causing a sanity checking error.

Reveal the monster before hurtling it.

3 years agofix github issue #587 - incompatible save files
PatR [Sun, 12 Sep 2021 12:31:01 +0000 (05:31 -0700)]
fix github issue #587 - incompatible save files

Save files from before the 'disambiguate WHACK' patch were not
necessarily compatible with ones after it, leading to potential
restore problems.

Comments in objclass.h (from before the patch) suggested that
inappropriate assumptions were being made about field layout.
This deliberately introduces new incompatibility and increments
EDITLEVEL to caused earlier save and bones files to be thrown
away.

Fixes #587

3 years agofix github issue #589 - gremlin crash
PatR [Sat, 11 Sep 2021 10:04:04 +0000 (03:04 -0700)]
fix github issue #589 - gremlin crash

when fleeing hero who was wearing gold dragon scales/mail and not
wielding any weapon.

When a gremlin was made to flee "artifact light", code originally
intended for Sunsword attempted to format 'uwep' as an artifact.  For
gold scales/mail instead of that, it gave a sane but inappropriate
value if wielding something or segfaulted if not wielding anything.

Fixes #589

3 years agofix #K3440/github issue #586 - losing object info
PatR [Wed, 8 Sep 2021 00:50:50 +0000 (17:50 -0700)]
fix #K3440/github issue #586 - losing object info

when an unseen monster picks up an item that the hero knows some
things about.  That's intentional, but vision is turned off while
engulfed so throwing or dropping something while swallowed always
treated it as being handled by an unseen monster.

If hero is swallowed or held by a monster or poly'd and holding a
monster, behave as it the monster can 'seen' by touch when items are
added to its inventory.

Closes #586

3 years agoobj->spe doc: scroll of scare monster
PatR [Tue, 7 Sep 2021 00:36:52 +0000 (17:36 -0700)]
obj->spe doc: scroll of scare monster

3 years agofixes entry
Pasi Kallinen [Mon, 6 Sep 2021 18:02:48 +0000 (21:02 +0300)]
fixes entry

3 years agoNon-metallic gloves protect worn rings from shock
Guillaume Clemens [Fri, 30 Jul 2021 14:37:17 +0000 (16:37 +0200)]
Non-metallic gloves protect worn rings from shock

3 years agoResistances gained from worn or wielded items also protect inventory
Pasi Kallinen [Mon, 6 Sep 2021 17:06:19 +0000 (20:06 +0300)]
Resistances gained from worn or wielded items also protect inventory

3 years agofix #K3436 - crash during restore
PatR [Sun, 5 Sep 2021 22:44:00 +0000 (15:44 -0700)]
fix #K3436 - crash during restore

triggered by Grayswandir's hallucination resistance.  If the game
is saved while hero is hallucinating but having that be suppressed
by wielding Grayswandir, is riding, and the steed is on an object,
then during restore the hero's location will be updated because
of the presence of the object but the attempt to display the hero
there is made before u.usteed has been restored and fails.

3 years agoMove sanity checking to start of main loop
Pasi Kallinen [Sun, 5 Sep 2021 07:14:12 +0000 (10:14 +0300)]
Move sanity checking to start of main loop

... just after clearing the object bypasses, as some
of the monster movement code may use object bypass flags.

3 years agoFixes entry for "Disambiguate blunt weapons"
PatR [Sat, 4 Sep 2021 21:46:24 +0000 (14:46 -0700)]
Fixes entry for "Disambiguate blunt weapons"

and additional comments.  Pull request #584 expands the oc_dir field
of objects[] from 2 bits to 3 in order to hold the weapon strike-
type bit mask.

Closes #584

3 years agoDisambiguate blunt weapons
copperwater [Thu, 2 Sep 2021 20:22:05 +0000 (16:22 -0400)]
Disambiguate blunt weapons

Currently weapons are set up as piercing, slashing, or whacking, using
their object's oc_dir field, with the intention that certain weapons
can classify as both. However, since oc_dir is only 2 bits and WHACK is
0, there's no way to unambiguously express some of these combinations.
Certain weapons such as the lucern hammer are defined as combination
piercing/blunt weapons, but the game just sees it as a piercing weapon.

This commit adds a third bit to oc_dir and promotes the WHACK constant
to its own bit. Nothing should be affected by this (wand directions and
the like should remain working as usual) other than the
blunt-and-something-else weapons being defined properly.

3 years agofixes entry for "Suddenly you cannot see it"
PatR [Sat, 4 Sep 2021 21:29:15 +0000 (14:29 -0700)]
fixes entry for "Suddenly you cannot see it"

Pull request #585 fixes incorrect XOR logic caused by changes
accompanying introduction of gold dragons 5 or 6 weeks ago.

Closes #585

3 years agoFix: 'Suddenly you cannot see it'
Michael Meyer [Fri, 3 Sep 2021 20:55:37 +0000 (16:55 -0400)]
Fix: 'Suddenly you cannot see it'

Updates to m_dowear_type(worn.c) in 5a09a01a13 inadvertently reversed
the effect of an xor near the end of the function, causing it to go from
testing whether a monster's status as 'seen' or 'unseen' changed over
the course of the function to testing whether it remained the same.

As a result, whenever an unseen, invisible monster donned a piece of
armor anywhere on the map, the message 'suddenly you cannot see it'
would be printed.  Fix the xor so that it goes back to testing whether
visibility changed since the start of the function.

3 years agoFix eel hiding in dry land
Pasi Kallinen [Fri, 3 Sep 2021 10:27:36 +0000 (13:27 +0300)]
Fix eel hiding in dry land

When an eel was hiding in a pool and a rolling boulder trap
launched a boulder on top of the pool, and the boulder then
filled the pool, the eel ended up hiding on the dry land.

As a stopgap measure, kill off any monster that is in the
pool location when the boulder hits the pool. This should
probably be expanded to handle flying monsters differently.

3 years agoFix: replace_terrain used wrong y2 coordinate
copperwater [Thu, 2 Sep 2021 13:36:45 +0000 (09:36 -0400)]
Fix: replace_terrain used wrong y2 coordinate

3 years agoTest for replace_terrain coordinates
Pasi Kallinen [Fri, 3 Sep 2021 05:27:17 +0000 (08:27 +0300)]
Test for replace_terrain coordinates

3 years agofixes entry for pull request #565 - booze
PatR [Thu, 2 Sep 2021 22:54:17 +0000 (15:54 -0700)]
fixes entry for pull request #565 - booze

Drinking booze has more impact on hero with an empty stomach.

Closes #565

3 years agoAmplify booze effect if drinking on empty stomach
Michael Meyer [Tue, 3 Aug 2021 21:05:22 +0000 (17:05 -0400)]
Amplify booze effect if drinking on empty stomach

Drinking booze on an empty stomach will amplify its effects
(i.e. increase the duration of the resulting confusion); stuffing
yourself before drinking will have the opposite effect.

3 years agoHandle buried zombifying corpses
Pasi Kallinen [Thu, 2 Sep 2021 17:54:32 +0000 (20:54 +0300)]
Handle buried zombifying corpses

When a zombifying corpse is buried, allow it to zombify and
dig itself out of the ground.

Also allow wishing for zombifying corpses.

3 years agofixes entry for polyfodder patch
PatR [Sun, 29 Aug 2021 22:40:05 +0000 (15:40 -0700)]
fixes entry for polyfodder patch

Add a fixes entry for the "Count all poly'ing tins as potential sliming
cures" commit.

Closes pull request #578

3 years agoCount all poly'ing tins as potential sliming cures
Michael Meyer [Fri, 20 Aug 2021 23:20:00 +0000 (19:20 -0400)]
Count all poly'ing tins as potential sliming cures

Popeye, used to check whether eating a particular tin is a potential
lifesaving action, considered tins of chameleon meat a cure for sliming
(since you can polymorph into a fiery monster), but didn't credit the
same possible curative power to other tins which can polymorph the hero.

Use the polyfodder macro (used elsewhere to check whether eating
something will polymorph a monster/pet) to determine whether a tin will
polymorph the hero.

3 years agobuild failure detected in CI
nhmall [Sun, 29 Aug 2021 03:10:49 +0000 (23:10 -0400)]
build failure detected in CI

The build in the CI was failing after commits today due to this error:
prob error for class 4 (28%)

It was caused by running
makedefs -o

Remove unnecessary invocation of makedefs with outdated options from
aftermakedefs.proj

3 years agodelete obsolete variable 'monstermoves'
PatR [Sat, 28 Aug 2021 23:24:23 +0000 (16:24 -0700)]
delete obsolete variable 'monstermoves'

Fixes entry and EDITLEVEL increment for 'Remove g.monstermoves'
commit.  Invalidates old save file contents.

Closes pull request #579

3 years agoRemove g.monstermoves
copperwater [Sun, 22 Aug 2021 13:53:24 +0000 (09:53 -0400)]
Remove g.monstermoves

It's redundant with g.moves, so there is no more need for it.

Way, way back, it looks like g.moves and g.monstermoves can and did
desync, where g.moves would track the amount of moves the player had
gotten (and would therefore increase faster if the player were hasted)
and g.monstermoves would track the amount of monster move cycles, aka
turns. But this has not been the case for a long time, and they both
increment together in the same location in allmain.c. There are no
longer any cases where they will not be the same value.

This is a save-breaking change because it changes struct
instance_globals, but I have not updated the editlevel in this commit.

3 years agoFixes entry
Pasi Kallinen [Sat, 28 Aug 2021 14:07:56 +0000 (17:07 +0300)]
Fixes entry

3 years agoRemove requirement of object probs adding to 1000
copperwater [Mon, 23 Aug 2021 00:01:14 +0000 (20:01 -0400)]
Remove requirement of object probs adding to 1000

When discussing the recent commit that removed makedefs -o from the
build process, nhmall pointed out that a sanity check ensuring all
objects within one class add up to 1000 probability had been removed as
well. This requirement was a perennial thorn in the side for anyone
doing anything that touches object probabilities, because allocating
probability to something meant deciding what to take it away from,
without a good way to evenly distribute that across all the other
members of the object class.

I had gotten around this in xNetHack by removing the sanity check and
making mkobj() total up the probability within an object class and then
using that instead of 1000. This commit takes a similar approach, but
instead of inefficiently recalculating the sum every time mkobj() is
called, it instead computes it at the start of the game or when
restoring the save file and stores it in a global variable.

This fixes a slight bias problem with rings - they are all supposed to
be of equal probability, but there are 28 of them and 1000 is not evenly
divisible by that, so the old formula made the later rings slightly more
likely. Now instead of a 35/1000 or 36/1000 chance, they are all
uniformly 1/28. (Internally they have a oc_prob of 1 now, not 0).

Gems are also weird, because their oc_prob values change every level.
This ought to have still worked without a change, because the arcane
formula for assigning the probabilities would still end up with them
adding to 1000. But I added in code to reset the total gem probability
anyway; this may help make the formula less arcane in the future.

There is still a sanity check against object classes having a nonzero
number of objects but zero total probability, in which case an
impossible will be thrown and every member of the class will be given
equal probability. I also downgraded the "probtype error" panic in
mkobj() to an impossible because it has a reasonable failure case -
return the first item in that class.

3 years agoGuidebook tweaks for ^E, section 5 header
PatR [Thu, 26 Aug 2021 22:32:52 +0000 (15:32 -0700)]
Guidebook tweaks for ^E, section 5 header

Describe #wizdetect as revealing hidden things rather than searching
for hidden things since the latter is described more than once as
possibly needing multiple tries.

For plain text output, the "Rooms and corridors" section header was
harder than necessary to notice because it seemed to run together
with the list of commands preceding it.
|
| u    #untrap
|
| 5.  Rooms and corridors
|
Inserting an extra blank line in between them is helpful.  That isn't
needed for Postscript/PDF output because the text of the section
title is rendered with bold font, but I didn't attempt to make the
extra line be conditional.  The 'roff directive is added as a comment
to the TeX source without knowing whether an extra blank line would
be useful there (doubtful).

3 years agoFix ball bypass sanity complaint
Pasi Kallinen [Thu, 26 Aug 2021 15:46:22 +0000 (18:46 +0300)]
Fix ball bypass sanity complaint

Be punished, get swallowed, drop the ball inside the monster
via the 'D' drop, kill the swallower - this issued a sanity
check complaint about the ball bypass flag.

In this case, the ball was "floating", not on any object chain,
when dropped inside the monster, so clear_bypasses didn't
clear the flag.

3 years agoReindent main loop
Pasi Kallinen [Thu, 26 Aug 2021 11:19:36 +0000 (14:19 +0300)]
Reindent main loop

No code change, just reindenting the main loop, as it wasn't
reindented when the inner part was split into separate function.

3 years agoClear bypasses at beginning of main loop
Pasi Kallinen [Thu, 26 Aug 2021 11:11:57 +0000 (14:11 +0300)]
Clear bypasses at beginning of main loop

Object bypass flag is used to check if an object was already
handled in an iteration loop, in cases where the linked list order
may change during iteration. The flags should never stay set
past a turn, if any were used.

Reset the bypass flags at the beginning of the main loop, without
checking g.context.move -flag; that flag gets reset if hero lifesaved.

3 years agounclutter dlb's main()
PatR [Thu, 26 Aug 2021 09:25:51 +0000 (02:25 -0700)]
unclutter dlb's main()

3 years agoreveal elapsed time during play
PatR [Wed, 25 Aug 2021 22:02:26 +0000 (15:02 -0700)]
reveal elapsed time during play

Have end of game disclosure and the ^X command display the amount
of time spent playing the current game instead of just putting that
in xlogfile.

This isn't an onscreen clock for speed runners as someone recently
asked about on reddit.  NetHack shouldn't attempt to handle that.

3 years agoless elapsed time: ! and ^Z
PatR [Wed, 25 Aug 2021 21:49:58 +0000 (14:49 -0700)]
less elapsed time: ! and ^Z

Suppress any time spent in a sub-shell or in the background when
accumulating total elapsed play time.

This won't help for leaving the game idle instead of saving and
restoring.  That's a can of worms I'd prefer to leave sealed.

3 years agoelapsed time handling
PatR [Wed, 25 Aug 2021 21:14:23 +0000 (14:14 -0700)]
elapsed time handling

The code has been assuming that time_t is some number of seconds.
That's valid for traditional Unix systems and for Posix compliant
systems but is not something guaranteed by the C standard.  (We ran
into a long time ago when trying out an alternate way to calculate
phase of moon.  That code made a similar assumption and broke one
of the ports.)

'ubirthday' also warrants being re-done but I've run out of energy.

3 years agosome restore.c reformatting
PatR [Tue, 24 Aug 2021 15:20:18 +0000 (08:20 -0700)]
some restore.c reformatting

Some reformatting I did while investigating the mimic-as-strange-object
vs protection-from-shape-changers situation.  Not part of the fix for
that and no change in behavior.

3 years agofix #K3422 - mimic remains as 'strange object'
PatR [Tue, 24 Aug 2021 15:09:30 +0000 (08:09 -0700)]
fix #K3422 - mimic remains as 'strange object'

even when protection from shape changers is in effect.  I'm not sure
why mimicking other things doesn't trigger the same sanity check
warning.  This fix works for the strange object case and I assume
that it doesn't break the more general case.

When investigating, I noticed that save and restore (even leaving
the level and then returning) causes cancelled shape changers to be
uncancelled.  Treat being cancelled similarly to having to having
protection from shape changers in effect:  shape changer is forced
to revert to its innate form and not allowed to change shape.

3 years agoUse enum value, not hardcoded number
Pasi Kallinen [Tue, 24 Aug 2021 08:34:28 +0000 (11:34 +0300)]
Use enum value, not hardcoded number

3 years agomissed dependency
nhmall [Tue, 24 Aug 2021 02:18:55 +0000 (22:18 -0400)]
missed dependency

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhmall [Mon, 23 Aug 2021 01:06:35 +0000 (21:06 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agocurses port
nhmall [Mon, 23 Aug 2021 01:04:19 +0000 (21:04 -0400)]
curses port

3 years agogit hash wasn't being used on unix
nhmall [Mon, 23 Aug 2021 00:57:49 +0000 (20:57 -0400)]
git hash wasn't being used on unix

3 years agoreword fixes37.0 entry
nhmall [Sun, 22 Aug 2021 23:34:12 +0000 (19:34 -0400)]
reword fixes37.0 entry

3 years agoWindows VS build failure if DLB wasn't defined
nhmall [Sun, 22 Aug 2021 23:23:09 +0000 (19:23 -0400)]
Windows VS build failure if DLB wasn't defined

3 years agofix nhl_loadlua() failures on Windows
nhmall [Sun, 22 Aug 2021 23:15:03 +0000 (19:15 -0400)]
fix nhl_loadlua() failures on Windows

The [dlb_]fopen() requires an RDBMODE argument on Windows.
ftell(), fseek(), and fread() interactions can be problematic otherwise.

3 years agoPrevent impossible trying to find a door position
Pasi Kallinen [Sun, 22 Aug 2021 15:44:17 +0000 (18:44 +0300)]
Prevent impossible trying to find a door position

When random dungeon level generation looks for room walls
to place doors at (for joining corridors or creating niches),
it complained about impossible, if the shaped theme room
doesn't have a valid place for a door.

Make the position routine return FALSE and let the
caller deal with it...

Observed this with the small circular themeroom which had
all 4 valid positions already joined with corridors, and
the niche function tried to add a niche to the room.

3 years agoignore visual studio .user files
nhmall [Sun, 22 Aug 2021 12:12:50 +0000 (08:12 -0400)]
ignore visual studio .user files

3 years agotweak baby/gold dragon tile
PatR [Sun, 22 Aug 2021 06:13:26 +0000 (23:13 -0700)]
tweak baby/gold dragon tile

Make the "eyebrows" yellow instead of gray for male and female baby
and adult gold dragons.

3 years agofixes entry for gold dragon scales in bones
PatR [Sun, 22 Aug 2021 05:55:57 +0000 (22:55 -0700)]
fixes entry for gold dragon scales in bones

Closes pull request #577

3 years agoFix: gold dragon scale mail remained lit in bones
copperwater [Wed, 18 Aug 2021 03:32:18 +0000 (23:32 -0400)]
Fix: gold dragon scale mail remained lit in bones

This is caused by the bones-pile-making routine using artifact_light()
as a test for whether it needs to call end_burn. Gold dragon scale mail
uses artifact_light(), but only returns true when its owornmask is set.
But owornmask was getting zeroed right before artifact_light() is
called. Fix is to move it right after instead.

Tested that Sunsword is not affected by this (created bones while
wearing gold dragon scales and wielding Sunsword in a dark area; when
returning to them, no light was emitted from the gravesite) because it
always returns true in artifact_light() irrespective of owornmask.

3 years agoremove test bit
nhmall [Sun, 22 Aug 2021 02:51:39 +0000 (22:51 -0400)]
remove test bit

3 years agobuild issue without DLB defined
nhmall [Sun, 22 Aug 2021 02:47:55 +0000 (22:47 -0400)]
build issue without DLB defined

3 years agorecent in_use comment typo
PatR [Sat, 21 Aug 2021 20:18:48 +0000 (13:18 -0700)]
recent in_use comment typo

3 years agomore visual studio build tweaks
nhmall [Sat, 21 Aug 2021 19:53:21 +0000 (15:53 -0400)]
more visual studio build tweaks

3 years agofollow-up build fixes for Windows
nhmall [Sat, 21 Aug 2021 19:48:40 +0000 (15:48 -0400)]
follow-up build fixes for Windows

3 years agosanity checking: bypassed billed object destroyed
Pasi Kallinen [Sat, 21 Aug 2021 15:50:13 +0000 (18:50 +0300)]
sanity checking: bypassed billed object destroyed

3 years agoThis is cron-daily v1-Jan-20-2020. files updated: Files
nhw_cron [Sat, 21 Aug 2021 12:24:08 +0000 (08:24 -0400)]
This is cron-daily v1-Jan-20-2020.  files updated: Files

3 years agosanity checking: obfree() vs obj->in_use
PatR [Sat, 21 Aug 2021 12:36:06 +0000 (05:36 -0700)]
sanity checking: obfree() vs obj->in_use

Drinking a potion sets the in_use flag so that it can be deleted
if found in a hangup save file.  That flag wasn't being cleared if
a shop-owned item is used up and goes onto the shop bill instead of
being discarded.  The recently revised object sanity checking was
complaining (turn after turn after turn until player paid for the
potion) that there was an object with its in_use bit set.

Restore only purges in_use objects in invent and didn't mess up
billing by getting rid such objects since they're on another list.

3 years agocompile NetHack-3.7 without makedefs-generated .h files
nhmall [Tue, 17 Aug 2021 18:43:29 +0000 (14:43 -0400)]
compile NetHack-3.7 without makedefs-generated .h files

This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:

date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.

pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

onames.h dependency and its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.

artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.

The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
    makedefs -d    (database)
    makedefs -r    (rumors)
    makedefs -h    (oracles)
    makedefs -s    (epitaphs, engravings, bogusmons)

date.c

Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)

nethack --dumpenums (optional, but on by default)

Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.

Uncomment #define NODUMPENUMS in config.h to disable this.

The updates to sys/windows/Makefile.gcc have not been tested yet.

3 years agopotionbreathe's obj->in_use
PatR [Fri, 20 Aug 2021 22:11:24 +0000 (15:11 -0700)]
potionbreathe's obj->in_use

potionbreathe() uses obj->in_use as a flag to inhibit wielded unholy
water from being dropped in case that gets broken against a monster
and triggers the hero to change from human were-critter to beast were-
critter.  Reset that to zero if caller hasn't already set it to 1.

3 years agoohitmon: obfree vs delobj
PatR [Fri, 20 Aug 2021 22:06:05 +0000 (15:06 -0700)]
ohitmon: obfree vs delobj

Make missiles that aren't launched by the hero and that hit a monster
use the routine that protects the Amulet and invocation items against
being deleted.  I don't think there are any cases where this matters
because those items don't break when they hit something, but be more
cautious.

3 years agoshk.c formatting
PatR [Fri, 20 Aug 2021 22:01:36 +0000 (15:01 -0700)]
shk.c formatting

Mostly wrapping wide lines.  No change in behavior except one
impossible warning now ends in "?" instead of "??".

3 years agodelobj() rejection
PatR [Thu, 19 Aug 2021 21:55:22 +0000 (14:55 -0700)]
delobj() rejection

If the Amulet or an invocation item refuses to be deleted, make sure
the retained object doesn't get left with its in_use bit set.  I'm not
sure whether there are any cases where this matters.

3 years agotool_in_use()
PatR [Thu, 19 Aug 2021 21:20:43 +0000 (14:20 -0700)]
tool_in_use()

tool_in_use() [for the '(' and '*' commands] has nothing to do with
the obj->in_use bit, so rename it to tool_being_used().

3 years agosanity check false positive for obj->nomerge
PatR [Thu, 19 Aug 2021 20:08:22 +0000 (13:08 -0700)]
sanity check false positive for obj->nomerge

The luckstone in the Mines and the amulet of reflection or bag of
holding in Sokoban have their 'nomerge' bit set until they make
it into the hero's inventory.  So don't complain about them when
sanity_check is enabled.

3 years agowhen spellbook being read becomes cursed
PatR [Thu, 19 Aug 2021 00:40:09 +0000 (17:40 -0700)]
when spellbook being read becomes cursed

Revisit a 3.6.1 fix.  When the hero is occupied reading a spellbook
and something causes it to become cursed without interrupting (post-
Wizard harassment's malignant aura), always stop reading instead of
just when the book's bknown flag is already set.

3 years agoextended object sanity checking
PatR [Thu, 19 Aug 2021 00:17:14 +0000 (17:17 -0700)]
extended object sanity checking

When sanity checking is enabled, check objects for bits used as
temporary flags that should always be cleared by the time that a
sanity check pass gets made:  o.in_use, o.bypass, and o.nomerge.

Also, fix glob checking.  It was unintentionally placed within
the braces of ``if (obj->owornmask) { ... }'' so didn't actually
check globs except for the unlikely case when wielded in one of
the uwep/uswapwep/uquiver slots.

3 years agosome potion.c formatting bits
PatR [Wed, 18 Aug 2021 20:18:26 +0000 (13:18 -0700)]
some potion.c formatting bits

3 years agoOselect() for monster's weapon
PatR [Tue, 17 Aug 2021 23:31:14 +0000 (16:31 -0700)]
Oselect() for monster's weapon

Make the Oselect() macro less likely to accidentally interfere with
caller's if-then-else usage.

3 years ago[not] leashing long worm['s tail]
PatR [Tue, 17 Aug 2021 23:26:51 +0000 (16:26 -0700)]
[not] leashing long worm['s tail]

Leashing a long worm isn't allowed so leashing its tail isn't either.
Make the rejection message be more specific for the tail case.

3 years agoLua: diagonals for selection floodfill
Pasi Kallinen [Sun, 15 Aug 2021 10:50:28 +0000 (13:50 +0300)]
Lua: diagonals for selection floodfill

3 years agoQt: deprecation warnings, again
Pasi Kallinen [Sun, 15 Aug 2021 07:58:39 +0000 (10:58 +0300)]
Qt: deprecation warnings, again

Check Qt version for the QFontMetrics::width vs horizontalAdvance.
Of course can't just #define horizontalAdvance to width, that would
be too easy ...

3 years agofix some VS warnings that recently appeared
nhmall [Sat, 14 Aug 2021 19:36:54 +0000 (15:36 -0400)]
fix some VS warnings that recently appeared

  ..\src\explode.c(884): warning C4028: formal parameter 1 different from declaration

  That one stems from commit 6b60618e0e.
  Adjust the prototype in include/extern.h to match the function definition in
  src/explode.c

  Also, a recent update to the Microsoft Visual Studio 2019 causes the
  compiler to complain while compiling a vendor c++ header (string) if
  warning C4774 is enabled.

  We force that warning to be enabled during the Makefile build, even though
  it is not enabled by default.

  Only do so in the Makefile.msc for c source files, and not for c++
  (sys/share/cppregex.cpp).

  See below for an example of the compiler complaint.

  cppregex.cpp
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  warning C4774: '_scprintf' : format string expected in argument 1 is
  not a string literal
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: e.g. instead of printf(name); use printf("%s", name); because
  format specifiers in 'name' may pose a security issue
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: consider using constexpr specifier for named string literals
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(583):
  note: see reference to function template instantiation 'std::string
  std::_Floating_to_string<float>(const char *,_Ty)' being compiled
          with
[
   _Ty=float
]

3 years agoQt: Fix Qt5 deprecation warnings
Pasi Kallinen [Sat, 14 Aug 2021 18:03:13 +0000 (21:03 +0300)]
Qt: Fix Qt5 deprecation warnings

Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.

Not thoroughly tested, but seems to work.

3 years agodefsym.h comment update
nhmall [Sat, 14 Aug 2021 13:16:27 +0000 (09:16 -0400)]
defsym.h comment update

3 years agomore sym-related content into single place
nhmall [Sat, 14 Aug 2021 12:33:38 +0000 (08:33 -0400)]
more sym-related content into single place

3 years agoFix eels hiding when a pool boiled off
Pasi Kallinen [Sat, 14 Aug 2021 10:33:04 +0000 (13:33 +0300)]
Fix eels hiding when a pool boiled off

Sanity check caught an eel hiding on floor; this was caused by
an exploding flaming sphere boiling off the pool the eel was
hiding in. The freezing water case was already handled, so
add the same, rather lackluster handling, to the fire case.

3 years agolookaround comments
Pasi Kallinen [Thu, 12 Aug 2021 16:38:26 +0000 (19:38 +0300)]
lookaround comments

trying to figure this out

3 years agomore defsym.h comment adjustments
nhmall [Thu, 12 Aug 2021 14:00:23 +0000 (10:00 -0400)]
more defsym.h comment adjustments

3 years agocomment correction in defsym.h
nhmall [Thu, 12 Aug 2021 13:21:06 +0000 (09:21 -0400)]
comment correction in defsym.h

3 years agofixes37.0 entry for pull request 574 (from entrez)
nhmall [Thu, 12 Aug 2021 13:12:58 +0000 (09:12 -0400)]
fixes37.0 entry for pull request 574 (from entrez)

3 years agoMerge branch 'trapdoor-consistency' of https://github.com/entrez/NetHack into pr574
nhmall [Thu, 12 Aug 2021 12:55:29 +0000 (08:55 -0400)]
Merge branch 'trapdoor-consistency' of https://github.com/entrez/NetHack into pr574

3 years agoFix up msgs when dropping obj on trapdoor
Michael Meyer [Wed, 11 Aug 2021 00:21:11 +0000 (20:21 -0400)]
Fix up msgs when dropping obj on trapdoor

Messages for dropping an object on a trapdoor or hole seemed to
imply they still operate by the rules of a pit (that any object on the
same square as the trap is automatically inaccessible).  Since this is
no longer true for trapdoors and holes as of 1b7c372f, it seems
misleading to say an item "tumbles into the hole" even when it doesn't
fall through and stays on the current level.

Even for an item which really did fall through to the level below, these
messages were redundant since they were immediately followed by
near-identical messages from down_gate(dokick.c).

Limit the "tumbles into the pit" messages to pits only, and rely on the
standard down_gate message for items which fall through a trap door
or hole.

3 years agoPermit blind feeling for objects on trapdoor
Michael Meyer [Wed, 11 Aug 2021 00:14:27 +0000 (20:14 -0400)]
Permit blind feeling for objects on trapdoor

Items on a trap door or on the edge of a hole are accessible (they can
be picked up, kicked, etc), but these locations were considered
inaccessible for purposes of feeling the ground for objects while blind.

3 years agoThis is cron-daily v1-Jan-20-2020. files updated: Files
nhw_cron [Tue, 10 Aug 2021 18:24:07 +0000 (14:24 -0400)]
This is cron-daily v1-Jan-20-2020.  files updated: Files

3 years agocomment typo
nhmall [Tue, 10 Aug 2021 18:01:29 +0000 (14:01 -0400)]
comment typo

3 years agoMerge branch 'defsym' into NetHack-3.7
nhmall [Tue, 10 Aug 2021 17:38:35 +0000 (13:38 -0400)]
Merge branch 'defsym' into NetHack-3.7

3 years agoheader files sym.h and defsym.h
nhmall [Sun, 8 Aug 2021 16:29:46 +0000 (12:29 -0400)]
header files sym.h and defsym.h

There were multiple symbol-related lists that had to be kept
in sync in various places.

Consolidate some of that into a single new file
    defsym.h
with a set of morphing macros that can be custom-called from
the various places that use the sym info without maintaining
multiple occurrences. Most maintenance can be done there.

Rename monsym.h to sym.h since it looks after some
symbols not related to monsters now too.

The defsym.h header file is included in multiple places to
produce different code depending on its use and the controlling
macro definitions in place prior to including it.

Its purpose is to have a definitive source for
pchar, objclass and mon symbol maintenance.

The controlling macros used to morph the resulting code are
used in these places:
  - in include/sym.h for enums of some S_ symbol values
    (define PCHAR_ENUM, MONSYMS_ENUM prior to #include defsym.h)
  - in include/objclass.h for enums of some S_ symbol values
    (define OBJCLASS_ENUM prior to #include defsym.h)
  - in src/symbols.c for parsing S_ entries in config files
    (define PCHAR_PARSE, MONSYMS_PARSE, OBJCLASS_PARSE prior
    to #include defsym.h)
  - in src/drawing.c for initializing some data structures/arrays
    (define PCHAR_DRAWING, MONSYMS_DRAWING, OBJCLASS_DRAWING prior
    to #include defsym.h)
  - in win/share/tilemap.c for processing a tile file
    (define PCHAR_TILES prior to #include defsym.h).

3 years agoUse mon_visible
Pasi Kallinen [Mon, 9 Aug 2021 16:16:36 +0000 (19:16 +0300)]
Use mon_visible

3 years agoMove movement tests
Pasi Kallinen [Mon, 9 Aug 2021 13:13:09 +0000 (16:13 +0300)]
Move movement tests

Rushing will go along a snaking corridor.

3 years agoMore movement tests
Pasi Kallinen [Sun, 8 Aug 2021 16:30:56 +0000 (19:30 +0300)]
More movement tests

Rush behaves different in ROOM vs CORR; in corridors, it'll
turn 90 degrees, but will not go in the opposite direction
from when it started.

3 years agotty: use bright colors directly on supporting terminals
Patric Mueller [Mon, 2 Aug 2021 23:03:30 +0000 (01:03 +0200)]
tty: use bright colors directly on supporting terminals

Terminals supporting more than 8 colors can directly display the bright
colors (upper 8 colors of the 16 color palette).

The tty port now only uses bold for displaying bright colors as a fallback to
previous behavior for terminals with 8 colors.

3 years agofix github issue #564 - unicorn vs displaced hero
PatR [Sat, 7 Aug 2021 00:59:53 +0000 (17:59 -0700)]
fix github issue #564 - unicorn vs displaced hero

Unicorns attempted to avoid being in direct line with the hero's
actual location even when displacement causes unicorn to think hero
was at some other spot.  Change to avoid lining up with presumed
location even if that leaves the monster lined up with the hero.

While in mon.c, reorder the static function declarations near the
beginning of the file to match their order within it.

Fixes #564

3 years agotribute update: The Amazing Maurice
PatR [Fri, 6 Aug 2021 00:44:04 +0000 (17:44 -0700)]
tribute update:  The Amazing Maurice

Add four new passages to The Amazing Maurice and His Educated Rodents,
bringing total to 14.

When wishing, accept truncated title "The Amazing Maurice" as well as
the full title.

3 years agodescription of stair destination for level 1 up
PatR [Thu, 5 Aug 2021 20:46:20 +0000 (13:46 -0700)]
description of stair destination for level 1 up

Having the opposite side of the stairs up from level 1 be unknown is
weird because the hero conceptually just came down those stairs at
the start of the game.  But it's tricky because remote destination
varies depending on whether the Amulet is being carried.  This gives
an accurate description of where the stairs lead (if you step on
them with the 'mention_decor' option On, or use the ':' command when
already on them).

|"There is a staircase up out of the dungeon here."
or
|"There is a branch staircase up to the Elemental Planes here."

It gives away a little information when carrying the Amulet, but not
much and anyone who gets that far deserves a break.