]> granicus.if.org Git - nethack/log
nethack
3 years agoshrink_glob nitpicking
PatR [Sun, 14 Nov 2021 07:45:47 +0000 (23:45 -0800)]
shrink_glob nitpicking

For a glob in a container carried by the hero, shrinking away to
nothing would have indirectly updated the container's weight when
obj_extract_self() was called, then the 'old_top_owt' value would
never be different from current topcontnr->owt.  That only matters
for the shrink-but-not-gone case and could only happen for the gone
case so didn't result in anything noticeably wrong.  But fix it to
match the comment about weight not being adjusted yet.

3 years agoignore visual studio files in util
nhmall [Sat, 13 Nov 2021 17:36:40 +0000 (12:36 -0500)]
ignore visual studio files in util

3 years agocut and paste error
nhmall [Sat, 13 Nov 2021 15:42:25 +0000 (10:42 -0500)]
cut and paste error

3 years agoupdate Install.windows for vs 2022 compiler
nhmall [Sat, 13 Nov 2021 15:39:00 +0000 (10:39 -0500)]
update Install.windows for vs 2022 compiler

Include visual studio 2022 in the list of compilers tested for build
- nmake Makefile.msc tested

3 years agovs 2022 is current version as of November 8, 2021
nhmall [Sat, 13 Nov 2021 15:32:33 +0000 (10:32 -0500)]
vs 2022 is current version as of November 8, 2021

3 years agoshrink_glob while away from level
PatR [Sat, 13 Nov 2021 07:05:55 +0000 (23:05 -0800)]
shrink_glob while away from level

If the hero left a level that had globs on the floor or in floor
containers or being carried by monsters and stayed away for a
while, returning to the level only shrunk them by one unit of
weight.  Account for all the time away.  The complexity of this
has steadily grown; I hope its peak has been reached.

3 years agoshrink_glob feedback
PatR [Fri, 12 Nov 2021 00:16:13 +0000 (16:16 -0800)]
shrink_glob feedback

When carrying a glob, possibly inside a container, give shrink
feedback more often (twice in the ~500 turn cycle to shrink from
20aum to 0aum rather than just once).

3 years agoweight of gold
PatR [Sun, 7 Nov 2021 21:27:44 +0000 (13:27 -0800)]
weight of gold

I had wizweight On when testing glob changes and noticed
|Slasher drops a gold piece (0 aum).

Coins are supposed to weigh 1/100 of a unit, and the calculation
rounds rather than simply truncates any fraction, but that still
yielded 0 for quantities of 1..49.  Force any non-zero stack of
gold to weigh at least 1 unit.

Also, add a check for attempting to weigh a quantity 0 or less
(of anything, not only for gold) just in case.

3 years agoproceed further into dochat() when deaf
nhmall [Sun, 7 Nov 2021 14:19:03 +0000 (09:19 -0500)]
proceed further into dochat() when deaf

3 years agodecaying glob tweaks
PatR [Sun, 7 Nov 2021 10:00:46 +0000 (02:00 -0800)]
decaying glob tweaks

Don't hardcode the weight (20) of an unaugmented glob, use
objects[].oc_weight (also 20) instead.

When a glob inside a container has decayed all the way to nothing
(weight 0), take it out before updating the container's weight.
Otherwise weight() would use objects[].oc_weight instead of 0 for
that glob.

3 years agodecaying globs of {ooze,pudding,slime}
PatR [Sun, 7 Nov 2021 01:24:36 +0000 (18:24 -0700)]
decaying globs of {ooze,pudding,slime}

Globs never rotted away but did become tainted after a relatively
short while, which seemed like a contradiction.  Change them to never
be tainted but shrink by 1 unit of weight approximately every 25
turns.  An ordinary glob (one that hasn't combined with any others)
starts out weighing 20 units, so it takes about 500 turns to vanish.
That's roughly twice as long as a corpse takes to rot away.

Shrinking globs give feedback when in hero's invent or in a container
in hero's inventory, but rarely (when going from an exact multiple
of 20 weight units; that is, from integral number of N globs to
N-1 + 19/20, or if weight reduction triggers an encumbrance change).
When a glob goes away completely, there is feedback for those two
circumstances and also for seeing the glob vanish from the floor.

I haven't touched how much nutrition eating a glob confers.  I have
changed formatting of glob names to use "small", "medium", "large",
"very large" instead of "small", [no adjective], "large", &c.  You
still need to have at least five globs coalesced together for the
adjective to become "medium", same amount as before.

I don't think EDITLEVEL needs to be modified but have incremented it
anyway to play things safe.

3 years agodetect visual studio 2019 16.11.5 after build test
nhmall [Wed, 3 Nov 2021 14:47:01 +0000 (10:47 -0400)]
detect visual studio 2019 16.11.5 after build test

3 years agotribute update: Night Watch and The Wee Free Men
PatR [Sun, 31 Oct 2021 02:16:35 +0000 (19:16 -0700)]
tribute update: Night Watch and The Wee Free Men

Add a page citation to passage #1 of Night Watch, and add five new
passages, briging the total to 12.

Add four new passages to The Wee Free Men, bringing the total to 13.

3 years agomore imp
nhmall [Fri, 29 Oct 2021 17:39:27 +0000 (13:39 -0400)]
more imp

3 years agovisual studio 2022 preview 7
nhmall [Fri, 29 Oct 2021 02:40:46 +0000 (22:40 -0400)]
visual studio 2022 preview 7

3 years agobad cast making sp_lev chameleon light source
nhmall [Thu, 28 Oct 2021 22:19:07 +0000 (18:19 -0400)]
bad cast making sp_lev chameleon light source

Closes #625

3 years agoMerge branch 'lightsource-mon-ptr' of https://github.com/entrez/NetHack into pr625
nhmall [Thu, 28 Oct 2021 22:17:52 +0000 (18:17 -0400)]
Merge branch 'lightsource-mon-ptr' of https://github.com/entrez/NetHack into pr625

3 years agoFix: bad cast making sp_lev chameleon light source
Michael Meyer [Thu, 28 Oct 2021 21:48:37 +0000 (17:48 -0400)]
Fix: bad cast making sp_lev chameleon light source

Giving new_light_source '(genericptr_t) mtmp' leads to the light
source's id.a_monst being set to 'mtmp->nmon' rather than 'mtmp',
since that's what is stored in the initial byte of the monst struct.
When mtmp->nmon == 0x0 this can cause a segfault in do_light_sources.

3 years agotile fix
nhmall [Thu, 28 Oct 2021 20:22:26 +0000 (16:22 -0400)]
tile fix

commit b88e17d04ec2bb37e2c12842e9f4c4a9 changed the order of some
objects but neglected to update the win/share/objects.txt tiles
to match.

In fairness, the error-alerting was broken at the time but has
since been resolved.

warning: for tile 46 (numbered 46) of objects.txt,
found 'lance' while expecting 'angled poleaxe / halberd'
warning: for tile 47 (numbered 47) of objects.txt,
found 'angled poleaxe / halberd' while expecting 'long poleaxe /
bardiche'
warning: for tile 48 (numbered 48) of objects.txt,
found 'long poleaxe / bardiche' while expecting 'pole cleaver / voulge'
warning: for tile 49 (numbered 49) of objects.txt,
found 'pole cleaver / voulge' while expecting 'pole sickle / fauchard'
warning: for tile 50 (numbered 50) of objects.txt,
found 'broad pick / dwarvish mattock' while expecting 'pruning hook /
guisarme'
warning: for tile 51 (numbered 51) of objects.txt,
found 'pole sickle / fauchard' while expecting 'hooked polearm /
bill-guisarme'
warning: for tile 52 (numbered 52) of objects.txt,
found 'pruning hook / guisarme' while expecting 'pronged polearm /
lucern hammer'
warning: for tile 53 (numbered 53) of objects.txt,
found 'hooked polearm / bill-guisarme' while expecting 'beaked polearm /
bec de corbin'
warning: for tile 54 (numbered 54) of objects.txt,
found 'pronged polearm / lucern hammer' while expecting 'broad pick /
dwarvish mattock
warning: for tile 55 (numbered 55) of objects.txt,
found 'beaked polearm / bec de corbin' while expecting 'lance'

3 years agofix error checking during tile processing
nhmall [Thu, 28 Oct 2021 20:08:59 +0000 (16:08 -0400)]
fix error checking during tile processing

noticed following a patch last night

3 years ago"someone"/"something" instead of "it"
PatR [Thu, 28 Oct 2021 19:55:32 +0000 (12:55 -0700)]
"someone"/"something" instead of "it"

I thought there were more places that checked for "it" and substituted
"someone" or "something".  Perhaps there are and I'm just not finding
them now.  Anyway, this extends x_monnam() and adds some_mon_nam() and
Some_Monnam() to do that during monster name formatting instead of
having various bits of code try fix it up after the fact.  The fixups
could be fooled by monsters given the name "it" or "It"; x_monnam()
won't be.

3 years agorefine "next boulder"
PatR [Thu, 28 Oct 2021 18:10:40 +0000 (11:10 -0700)]
refine "next boulder"

Guard against any other places besides minimal_xname() that set up a
fake object without being aware that for boulders the corpsenm field
should be 0 rather than NON_PM.  If that field is unexpectedly -1,
xname() will format it as ordinary "boulder" rather than producing
special "next boulder".  An explict value of 1 is now required for
the latter.

3 years agofix github issue #603 - guarding prize items
PatR [Thu, 28 Oct 2021 08:05:18 +0000 (01:05 -0700)]
fix github issue #603 - guarding prize items

Reported by Vivit-R with comments by several others.  The prize item
in one of the closets off the Sokoban treasure zoo is sometimes
missing, most likely picked up by an elf who won't be dissuaded by
the presence of engraved Elbereth or a scroll of scare monster.

This fix prevents monsters from targetting the mines' and sokoban's
prizes for pickup (or for eating).  Once the hero picks either of the
prizes up, they stop being prizes and will be ordinary monster fodder
if dropped/stolen/stashed.

One of the comments by copperwater suggested this approach as a
possible way to fix things.  I had already implemented it from scratch
before noticing that.  It handles the usual monster behavior toward
items, but there could easily be some unusual cases still susceptible
to taking the prize before the hero gets to it.  Those are the breaks.

Fixes #603

3 years agomore baalz - digging in front of the "eyes"
PatR [Wed, 27 Oct 2021 23:21:03 +0000 (16:21 -0700)]
more baalz - digging in front of the "eyes"

like the leg hackery, if the baalz level gets flipped during creation
the fixup that modifies the locations in front of the eyes to allow
digging needs to deal with that too.

3 years agofixes entry for pull request #598 - baalz level
PatR [Wed, 27 Oct 2021 22:52:01 +0000 (15:52 -0700)]
fixes entry for pull request #598 - baalz level

If the baalz level got transposed during creation, the fixup for
a decorative portion of the map didn't work properly.  Monsters
eligible to be created at pool locations could end up trapped in
a couple of inaccessible locations.

[To be fair, the baalz hackery predates level flipping....]

Closes #598

3 years agoFix: baalz_fixup didn't account for level rotation
Michael Meyer [Thu, 30 Sep 2021 13:43:14 +0000 (09:43 -0400)]
Fix: baalz_fixup didn't account for level rotation

Because some spots in the fly's 'legs' on the Baalzebub lair level are
specified as pools in the level file, then later converted to walls in a
post-generation fixup routine, monsters can be generated on those spots
and then left walled up and inaccessible, Cask of Amontillado style.
For the love of God, makemon-tresor!

Some code already existed to relocate these monsters after generating
the level, but it depends on misorientated 'leg segments' being fixed up
in a particular way.  That wasn't being triggered because it didn't
account for the possible rotation of the level; as a result, the
monsters in the leg segments wouldn't be relocated, and the leg segments
themselves would continue to have the wrong orientation.

Account for possible level rotation so that the monsters are relocated
properly (and the leg segments are 'fixed').

3 years agofix github issue #623 - soldiers and mattocks
PatR [Wed, 27 Oct 2021 22:36:32 +0000 (15:36 -0700)]
fix github issue #623 - soldiers and mattocks

Reported by eakaye.  Selection of equipment when creating a soldier
or watchperson can pick a polearm, but random selection among those
had a chance to choose dwarvish mattock which doesn't use polearms
skill and isn't appropriate for a human soldier or watchperson.
Not mentioned, but lance was in the same boat.

Change the selection to only pick something which uses polearms
skill, then make that moot by moving lance and dwarvish mattock out
of the midst of the polearms so that they're no longer candidates
for special case rejection.

A couple of other things which might have had a similar issue were
already ok.  Giving a polearm when creating a troll selects between
a few choices rather than among all the polearms.  And wishing for
"polearm" only considers items which use polearms skill.

While changing objects.h to reorder the two non-polearms, I removed
a bunch of tabs that were present in the scroll definitions.

EDITLEVEL is incremented due to objects[] reordering, so existing
save and bones files will be invalidated.

Fixes #623

3 years agocommit message for pull request #599 - artifacts
PatR [Tue, 26 Oct 2021 19:09:36 +0000 (12:09 -0700)]
commit message for pull request #599 - artifacts

Explicitly un-create a randomly generated artifact if it gets
rejected (too big to include as a treasure drop with a small corpse)
so that it remains eligible for creation later.  And when generating
random contents for a new container, explicitly avoid artifacts
(which were already implicitly avoided).

Closes #599

3 years agoFormally block artifacts as random box contents
Michael Meyer [Thu, 30 Sep 2021 15:22:36 +0000 (11:22 -0400)]
Formally block artifacts as random box contents

Another (latent) case of an artifact possibly being generated and
immediately deleted: part of the process of a mimic disguising itself as
an item involves generating a random object, then deleting it.  If this
item is a box or sack, it will generate with random contents, which will
be deleted along with the container. If artifacts are allowed as random
box contents, this can silently remove an artifact from being available
in the game.

This is effectively blocked already, since none of the artifacts
eligible for random generation are items from classes marked as valid
box contents (see boxiprobs[] in mkobj.c).  Nonetheless, formally
preventing artifacts from generating as box contents will guarantee this
issue won't crop up if a randomly generated artifact tool, ring, etc, is
added in the future.

3 years agoFix: artifacts silently removed from the game
Michael Meyer [Thu, 30 Sep 2021 15:05:50 +0000 (11:05 -0400)]
Fix: artifacts silently removed from the game

Death drops will generate a random item, which may be an artifact.
After the object is created, some rules are applied to check whether its
size matches the monster that dropped it; if it fails these checks,
the item is deleted.  aosdict recently pointed out that if the death
drop was an artifact, this would permanently remove it from the game.

Use artifact_exist(..., FALSE) in various cases where potential
artifact objects are created, then immediately removed.  This will
prevent artifacts from being removed from play by marking the artifact
as available to create again.

3 years agofix #K3474 - "you detect it where <foo> was"
PatR [Tue, 26 Oct 2021 10:11:55 +0000 (03:11 -0700)]
fix #K3474 - "you detect it where <foo> was"

A vampire in bat form was seen via infravision or possibly telepathy,
then when it changed into fog cloud form the feedback was
|You now detect it where the vampire bat was.
The message substitutes "detect" for "see" when the new form can't
be seen and the monster name formatting yields "it" for that case.

Give a vanish message instead since that is effectively what happens.

3 years agofix pull request #621 - potential divide by 0
PatR [Mon, 25 Oct 2021 21:51:26 +0000 (14:51 -0700)]
fix pull request #621 - potential divide by 0

The pull request by argrath changes weight_cap() to never return a
value less than 1 because try_lift() divides by that return value
and a 0 would trigger a crash.  The code involved is used when
attempting to pull a monster out of a pit via #untrap.

I'm fairly sure that weight_cap() can never produce a value that's
less than 1 already, but have put in a variation of the PR's fix.
I've also implemented a different fix that removes the division
from try_lift().  The original code seems to have gone out of its
way to avoid calculating inv_weight() twice, but doing the latter
(for the once in a hundred games where it might happen) greatly
simplifies things by removing details of carrying capacity.

Fixes #621

3 years agore-do the wounded legs fix
nhmall [Mon, 25 Oct 2021 01:41:49 +0000 (21:41 -0400)]
re-do the wounded legs fix

3 years agowounded legs check in insight.c
nhmall [Mon, 25 Oct 2021 01:34:05 +0000 (21:34 -0400)]
wounded legs check in insight.c

close #620

3 years agomore comment accuracy
nhmall [Sun, 24 Oct 2021 22:04:57 +0000 (18:04 -0400)]
more comment accuracy

3 years agofix github issue #614 - applying polearm at doors
PatR [Sun, 24 Oct 2021 17:06:30 +0000 (10:06 -0700)]
fix github issue #614 - applying polearm at doors

Reported by G7Nation; attacking walls and such with a polearm just
gave lackluster "you miss; nobody's there" feedback.

Make applying a polearm at some non-monster locations give feedback
similar to using 'F'orcefight with melee weapons.  Was
|You miss; there is no one there to hit.
now
|You uselessly attack the closed door.

Also, extend the supported locations to include dungeon furniture.
Was
|You attack thin air. ('F')
now
|You harmlessly attack the throne. ('F')
|You uselessly attack the throne. ('a')

This doesn't address #613:  attempting to hit non-visible locations
with an applied polearm.

Closes #614

3 years agocomment accuracy
nhmall [Sun, 24 Oct 2021 13:31:31 +0000 (09:31 -0400)]
comment accuracy

The function involved is a different one now, but the comment had not
been updated.

3 years agoclosed door descriptions
PatR [Sun, 24 Oct 2021 00:33:39 +0000 (17:33 -0700)]
closed door descriptions

3 years agomove compiler override note above the autodetection
nhmall [Sat, 23 Oct 2021 16:30:02 +0000 (12:30 -0400)]
move compiler override note above the autodetection

3 years agobreaking wielded fragile item against iron bars
PatR [Sat, 23 Oct 2021 02:11:51 +0000 (19:11 -0700)]
breaking wielded fragile item against iron bars

Reported by entrez, wielding something fragile (potion of acid
perhaps), and using F to smash it against iron bars called breaktest()
directly, then a second time indirectly through hero_breaks() via
hit_bars().  There is a random chance to resist breaking (99% for
artifacts, 1% for other items) so breaktest() might say that something
will break on the first call and that it will not break on the second
call, or vice versa.  That could remove uwep from inventory then leave
it in limbo without destroying it, or destroy uwep without removing it
from inventory first triggering impossible "obfree: deleting worn obj".

3 years agoMerge branch 'pr617' into NetHack-3.7
nhmall [Fri, 22 Oct 2021 19:24:37 +0000 (15:24 -0400)]
Merge branch 'pr617' into NetHack-3.7

3 years agouse %lu in format string in timer_sanity_check()
nhmall [Fri, 22 Oct 2021 19:23:07 +0000 (15:23 -0400)]
use %lu in format string in timer_sanity_check()

closes #617

3 years agoMerge branch 'fix-format-char' of https://github.com/argrath/NetHack into pr617
nhmall [Fri, 22 Oct 2021 19:19:25 +0000 (15:19 -0400)]
Merge branch 'fix-format-char' of https://github.com/argrath/NetHack into pr617

3 years agore-enable -Wunreachable-code under clang
nhmall [Fri, 22 Oct 2021 16:27:10 +0000 (12:27 -0400)]
re-enable -Wunreachable-code under clang

whitelist the valid cases showing up

If an earlier version of clang is showing more cases (particularly
if they don't make sense), the re-enabling of the warning in
sys/unix/hints/include/compiler.2020 can be made clang-version
specific instead. I had no way to test earlier versions.

3 years agouse %lu for unsigned long
SHIRAKATA Kentaro [Fri, 22 Oct 2021 16:07:40 +0000 (01:07 +0900)]
use %lu for unsigned long

`curr->tid` is unsigned long, so use `%lu`.

3 years agofeedback for monster jumping onto polymorph trap
PatR [Thu, 21 Oct 2021 19:07:19 +0000 (12:07 -0700)]
feedback for monster jumping onto polymorph trap

Give feedback for "<Mon> jumps onto a polymorph trap" in more
circumstances.  It used to give the message if the monster could
be seen, and it would map the trap if the monster's location could
be seen.  That led to some confusion when an infra-visible monster
was at a spot in the dark so the trap was accurately described but
didn't get mapped.

Map the trap if either the monster's or the trap's location can be
seen.  If it isn't already known and isn't becoming known (the
infravision case), say "hidden trap" instead of "polymorph trap"
in the message.  Give the "jumps onto trap" message if either the
monster can be seen or the trap's spot can be seen.  When monster
can't be seen, it would normally be described as "It"; switch to
"Someone" (when humanoid) or "Something" (non-humanoid) instead.

Minor unrelated bit:  the use-container action was between the 2nd
and 3rd polymorph cases.  Move it, after the third one.

3 years agoMerge branch 'pr616' into NetHack-3.7
nhmall [Thu, 21 Oct 2021 17:36:50 +0000 (13:36 -0400)]
Merge branch 'pr616' into NetHack-3.7

3 years agocheck for NULL Lua_State prior to lua_close()
nhmall [Thu, 21 Oct 2021 17:34:21 +0000 (13:34 -0400)]
check for NULL Lua_State prior to lua_close()

fixes #616

3 years agoMerge branch 'guard-luaclose' of https://github.com/argrath/NetHack into pr616
nhmall [Thu, 21 Oct 2021 17:30:42 +0000 (13:30 -0400)]
Merge branch 'guard-luaclose' of https://github.com/argrath/NetHack into pr616

3 years agogcc 11 warning
nhmall [Thu, 21 Oct 2021 17:24:38 +0000 (13:24 -0400)]
gcc 11 warning

../win/tty/wintty.c:4043:39: warning: argument 2 of type â€˜int[3]’ with mismatched bound [-Warray-parameter=]
 4043 | check_fields(boolean forcefields, int sz[3])
      |                                   ~~~~^~~~~
../win/tty/wintty.c:221:38: note: previously declared as â€˜int *’
  221 | static boolean check_fields(boolean, int *);
      |                                      ^~~~~

3 years agoguard lua_close()
SHIRAKATA Kentaro [Thu, 21 Oct 2021 17:13:17 +0000 (02:13 +0900)]
guard lua_close()

nhl_done() can be called with L == NULL.
So lua_close() should be guarded.

3 years agoclang 12 warning
nhmall [Thu, 21 Oct 2021 15:53:01 +0000 (11:53 -0400)]
clang 12 warning

makedefs.c:1560:5: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
    "  ",
    ^
makedefs.c:1559:5: note: place parentheses around the string literal to silence warning
    "currently available will not suffice for proving that P != NP or        "
    ^
1 warning generated.

3 years agofixes37.0 updates for pr612, 613, 615
nhmall [Thu, 21 Oct 2021 12:41:42 +0000 (08:41 -0400)]
fixes37.0 updates for pr612, 613, 615

closes #612
closes #613
closes #615

3 years agoinitialize attknum
SHIRAKATA Kentaro [Thu, 21 Oct 2021 12:17:36 +0000 (21:17 +0900)]
initialize attknum

`attknum` is declared without initialization, and is used on
find_roll_to_hit().  This leads unexpected result.

3 years agorevert MAX_RADIUS change
SHIRAKATA Kentaro [Thu, 21 Oct 2021 10:43:45 +0000 (19:43 +0900)]
revert MAX_RADIUS change

On 59818fb, MAX_RADIUS was changed from 15 to 16 to intend to support
"radius 0".  But MAX_RADIUS doesn't means the range but outer bound of
the radius table, so it should not be changed, and this change led
possible out-of-bound access on view_from() and do_clear_area() in
vision.c.

This commit reverts the change and avoids the problem.

3 years agofix pointer precedence
SHIRAKATA Kentaro [Wed, 20 Oct 2021 20:38:17 +0000 (05:38 +0900)]
fix pointer precedence

3 years agofix #K3472 - stale perm_invent when engraving
PatR [Wed, 20 Oct 2021 21:56:01 +0000 (14:56 -0700)]
fix #K3472 - stale perm_invent when engraving

Engraving with a weapon which has known enchantment or with a magic
marker which has known charge count that decremented the amount did
so without updating the persistent inventory display.  Report was
for curses but applied to every interface that can show perm_invent.

This includes some reformatting (mostly
 if {
 }
 else {
 }
to
 if {
 } else {
 }
multiple times; also add some new braces after 'if' or 'else' where
one half already had those and the other didn't).  And removal of
some unnecessary 'register' designators.

Plus fix up one sanity check which complained if number of charges
being used was more than a marker had, but then let the engraving
continue and decrement the count by that large amount.  If that
impossible situation ever occurred, it would result in a marker
with negative charges.

3 years agoboulders vs vault walls
PatR [Mon, 18 Oct 2021 19:55:28 +0000 (12:55 -0700)]
boulders vs vault walls

Noticed when testing the "wall_angle: unknown" fix, if there is a
boulder rather than a door in the breach in a vault's walls at the
spot where the guard arrives, the guard would walk onto it, tell the
hero to drop any gold and follow, then move back.  The boulder would
remain in the hero's way and couldn't be pushed because the guard was
in the boulder's way.  Have the guard smash any such boulder(s) into
rocks when arriving (with no explanation for how that is accomplished,
just a message about seeing or hearing boulder(s) shatter).  Later
when repairing the walls, delete any rocks or boulders at all vault
wall locations (even when no gap-to-wall repair is needed).

3 years agoanother "next boulder" bit
PatR [Mon, 18 Oct 2021 19:10:38 +0000 (12:10 -0700)]
another "next boulder" bit

simpleonames() calls minimal_xname() which was setting up a dummy
object and making its corpsenm field be NON_PM.  For a boulder, that
yielded "next boulder" instead of the intended "boulder".

3 years agoanother melting ice follow-up
nhmall [Sun, 17 Oct 2021 13:52:42 +0000 (09:52 -0400)]
another melting ice follow-up

3 years agomelting ice follow-up
nhmall [Sun, 17 Oct 2021 12:20:50 +0000 (08:20 -0400)]
melting ice follow-up

3 years agomelting ice timeout issues
nhmall [Sun, 17 Oct 2021 02:22:33 +0000 (22:22 -0400)]
melting ice timeout issues

Reported directly to devteam by entrez via email:
>
> I noticed some potential issues with (melting) ice:
>
>   * Digging down into ice, or setting a land mine on the ice and
>   triggering it, doesn't remove the melt_ice timeout, so it can result
>   in a sequence like dig down -> pit fills with water -> freeze water
>   -> freezing water tries to set melt_ice timeout -> duplicate timeout
>   impossible.  Or if you don't freeze the water again, melt_ice will
>   run on a non-ice surface, which might at least produce strange
>   messages.
>
>   * Setting a land mine on ice: melting ice doesn't do anything with
>   the trap, so there is still a land mine which you can trigger by
>   flying over the water (the land mine's trigger is also still
>   described as being 'in a pile of soil', despite being underwater at
>   this point).  Similar thing happens with bear traps.
>
>   * Not really related to _melting_ ice, but an exploding land mine
>   doesn't reset the typ from ICE to FLOOR (like normal digging does),
>   so it will result in a square with a pit that is also an ice square,
>   where the ice can melt under the pit and produce a combination
>   pit/moat.  If you then freeze the moat, the pit reappears on top of
>   the ice.

3 years agomore github issue #606 - wall repair vs doors
PatR [Sat, 16 Oct 2021 18:35:11 +0000 (11:35 -0700)]
more github issue #606 - wall repair vs doors

Fix the vault repair issue that could lead to "wall_angle: unknown"
warning.  Unlike shop repair, the original wall info isn't available
so this recreates it.  The extra 'flags' field added yesterday could
be eliminated but this leaves it in place.

Fixes #606

3 years agotravelling through boulders
PatR [Sat, 16 Oct 2021 16:54:08 +0000 (09:54 -0700)]
travelling through boulders

If the hero can move to a boulder's location via m<dir>, allow travel
to do so too.  You will always stop on the boulder spot rather than
keep going toward the destination because of change in visibility at
a boulder spot.

Giants should be able to see over boulders, and doing that for poly'd
hero would probably be straightforward, but when not poly'd, seeing a
giant beyond a boulder and vice versa seems like it would be a can of
giant-sized worms.

A couple of other miscellaneous changes are mixed in with this.

3 years agosome trailing whitespace in src, include
nhmall [Sat, 16 Oct 2021 16:12:21 +0000 (12:12 -0400)]
some trailing whitespace in src, include

3 years agotrailing blank
nhmall [Sat, 16 Oct 2021 15:29:19 +0000 (11:29 -0400)]
trailing blank

3 years agoMerge branch 'pr573' into NetHack-3.7
nhmall [Sat, 16 Oct 2021 14:53:40 +0000 (10:53 -0400)]
Merge branch 'pr573' into NetHack-3.7

3 years agofix m-prefix movement into warning symbol (pr573)
Michael Meyer [Tue, 10 Aug 2021 14:28:07 +0000 (10:28 -0400)]
fix m-prefix movement into warning symbol (pr573)

https://github.com/NetHack/NetHack/pull/573 by entrez
Pull request comment states:
"Moving into a position containing a warning symbol with m-<direction> to
'safely' move would still attack as though the 'm' prefix was not
specified.  Ensure warning symbols are counted as 'detected' monsters
for this purpose, to avoid falling through to do_attack()."

Closes #573

3 years agoMerge branch 'pr602' into NetHack-3.7
nhmall [Sat, 16 Oct 2021 14:38:27 +0000 (10:38 -0400)]
Merge branch 'pr602' into NetHack-3.7

3 years agovariation of imp's pr 602 period-speak
HMM [Sat, 9 Oct 2021 02:35:42 +0000 (22:35 -0400)]
variation of imp's pr 602 period-speak

This pr is not merged word-for-word from the original pull request
by Vivit-R

Closes #602

3 years agoout-of-bounds access in farlook pr592
nhmall [Sat, 16 Oct 2021 14:16:13 +0000 (10:16 -0400)]
out-of-bounds access in farlook pr592

https://github.com/NetHack/NetHack/pull/592 comment states:
"In commit db68395, most of the instances of xdir and ydir here were
changed to u.dx and u.dy, but not all of them. The remaining ones are
out-of-bounds on xdir and ydir, because i is always set to 12 from an
earlier loop and is no longer involved in handling user input. They
should be u.dx and u.dy like the rest."

3 years agoMerge branch 'fix-asan-issues' of https://github.com/copperwater/NetHack into pr592
nhmall [Sat, 16 Oct 2021 14:14:42 +0000 (10:14 -0400)]
Merge branch 'fix-asan-issues' of https://github.com/copperwater/NetHack into pr592

3 years agofix github issue #606 - shop wall repair
PatR [Fri, 15 Oct 2021 22:43:23 +0000 (15:43 -0700)]
fix github issue #606 - shop wall repair

triggering an impossible warning about "wall_angle: unknown" due
to the known conflict between door state and wall info which both
overlay the flags field for map locations.

Reported and diagnosed by vultur-cadens:  if a shop's wall was dug
open, followed by use of locking magic to plug the gap with a door,
and then unlocking that door, the D_CLOSED door flag was left as
invalid wall_info when shop damage was repaired.  Map re-display
complained.  Leaving the door locked or opening it after unlocking
did not result in any complaint because the values for those door
states do not conflict with wall angle values.

The problem was reproducible and is now fixed by adding an extra
field to the shop damage structure.  A similar change has been
made to the vault guard's 'fake corridor' structure but I have no
test case for that so don't know whether it makes any difference.
At least it doesn't seem to have broken anything.

Existing save and bones files are invalidated by the fixes.

Fixes #606

3 years agofixes entry for consoletty.c fix
nhmall [Wed, 13 Oct 2021 01:23:29 +0000 (21:23 -0400)]
fixes entry for consoletty.c fix

Closes #604

3 years agoconsoletty.c preprocessor directives
nhmall [Wed, 13 Oct 2021 01:15:54 +0000 (21:15 -0400)]
consoletty.c preprocessor directives

The preprocessing was a little messed up if VIRTUAL_TERMINAL_SEQUENCES was not
defined.

3 years agoremove unused globals: save_cm, was_waterlevel
PatR [Tue, 12 Oct 2021 18:41:56 +0000 (11:41 -0700)]
remove unused globals: save_cm, was_waterlevel

From entrez.  Since restoring was removed separately it was easier
to edit the files manually than to use his diff.

3 years agoThis is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt
nhw_cron [Mon, 11 Oct 2021 22:24:05 +0000 (18:24 -0400)]
This is cron-daily v1-Jan-20-2020.  guidebook updated: doc/Guidebook.txt

3 years agoremove a warning with gcc on Windows
nhmall [Mon, 11 Oct 2021 22:14:09 +0000 (18:14 -0400)]
remove a warning with gcc on Windows

"braces around scalar initializer"

3 years agolast? boulder change - Guidebook update
PatR [Mon, 11 Oct 2021 21:50:29 +0000 (14:50 -0700)]
last? boulder change - Guidebook update

Describe the new feature of m<dir> making it feasible to move to a
boulder'd spot without pushing.  Giving specific information among
vague descriptions is awkward....

While in there, move a handful of sentences to separate lines as per
the 'roff guidelines.  I did the same for Guidebook.tex even though
it's not needed there, to try to keep things parallel.

3 years agoattempt to fix mingw build
nhmall [Mon, 11 Oct 2021 19:08:05 +0000 (15:08 -0400)]
attempt to fix mingw build

This was detected by one of the CI builds.

3 years agotrailing blanks
nhmall [Mon, 11 Oct 2021 17:53:55 +0000 (13:53 -0400)]
trailing blanks

3 years agofix misaligned potion colors
nhmall [Mon, 11 Oct 2021 17:36:10 +0000 (13:36 -0400)]
fix misaligned potion colors

Misaligned potion colors due to lack of reset_glyphmap() following obj shuffle.

This issue only impacted a new game

3 years agoWindows virtual terminal sequences
nhmall [Mon, 11 Oct 2021 13:48:48 +0000 (09:48 -0400)]
Windows virtual terminal sequences

Microsoft has been making a recommendation that programs should switch
from using the classic low-level console API calls to virtual terminal
sequences for a couple of years.

References:
"Our recommendation is to replace the classic Windows Console API with virtual
terminal sequences. This article will outline the difference between the two
and discuss the reasons for our recommendation."
From:
Classic Console APIs versus Virtual Terminal Sequences
https://docs.microsoft.com/en-us/windows/console/classic-vs-vt

The online documentation for WriteConsoleOutputCharacter() and
WriteConsoleOutputAttribute() have this disclaimer on them:
"This document describes console platform functionality that is no longer a
part of our ecosystem roadmap. We do not recommend using this content in new
products, but we will continue to support existing usages for the indefinite
future. Our preferred modern solution focuses on virtual terminal sequences
for maximum compatibility in cross-platform scenarios. You can find more
information about this design decision in our classic console vs. virtual
terminal document."

Since NetHack started out as a terminal program, before there was a
Windows "classic" console API introduced with Windows NT, it seemed only
fitting that the Windows console port should evolve in the virtual terminal
direction.

This is a first stab at it. The performance won't be as instantaneous as
the low-level console API's. That's likely partly because of this consoletty.c
initial implementation, but it may also partly be because under the hood in
the OS, there's recognitions/translations/conversions going on. Microsoft
states it will continue to evolve the Windows Terminal and console, and
hopefully it will improve. Hopefully it isn't too slow to play. It still
attempts to take advantage of the back buffer stuff that Barton House
introduced to minimize screen updates. At this point, it can still be
recompiled without the virtual terminal support by defining NO_VT when
compiling consoletty.c, or by commenting out the definition of
VIRTUAL_TERMINAL_SEQUENCES at the top of sys/windows/consoletty.c

That's the informational news, and the negative news out of the way.

There's some good news too. Because the virtual terminal sequences
support include 24-bit color support, the Windows console under virtual
terminal sequence can provide a more pleasant set of colors to the NetHack
console interface. To that end, some color changes have been implemented
in consoletty.c now.

It makes the console port ready to accept and display 24-bit color from
the NetHack core, if that should ever happen, as well.

As usual with a first implementation, there may be some bugs. Reports
are welcome.

3 years agoand even more boulders...
PatR [Mon, 11 Oct 2021 01:05:11 +0000 (18:05 -0700)]
and even more boulders...

Revise the m<dir>-toward-boulder handling to let a hero who would be
able to squeese into the boulder's spot if it was blocked from being
pushed to do the squeeze without any pushing.

Unlike the previous changes, this might have an impact on play.  It
allows squeezing under then stepping past an unblocked boulder that's
in a corridor in order to be able to push it back the other direction
where maybe there's more room to maneuver it out of the way.

3 years agoyet more boulders: allow m<dir> to not push them
PatR [Sun, 10 Oct 2021 22:02:21 +0000 (15:02 -0700)]
yet more boulders: allow m<dir> to not push them

Allow a hero polymorphed into a giant to move to a boulder's spot
via m<dir> no-pickup move, instead of having to push it until the
way is blocked by something and then having push failure move hero
to the spot.

Also change m<dir> when not a giant to no longer push the boulder.
No time will elapse when not moving unless hero who didn't know
that there was a boulder there learns that one is.  Since no actual
push attempt gets performed, player doesn't learn whether there is
anything beyond the boulder that inhibits it from being pushed.

3 years agofix the new boulder->next_boulder sanity check
PatR [Sun, 10 Oct 2021 20:14:01 +0000 (13:14 -0700)]
fix the new boulder->next_boulder sanity check

3 years agoboulder sanity checking
PatR [Sun, 10 Oct 2021 19:59:17 +0000 (12:59 -0700)]
boulder sanity checking

Three new checks:
 1) boulders are expected to be at the top of their piles, or when
    not on top, only other boulders are above them;
 2) boulders shouldn't be located at water or lava spots;
 3) verify that boulders don't have their 'next_boulder' flag still
    set at times when sanity checks take place; that's only valid
    during moverock() [plus its calls to boulder_hits_pool()].

3 years ago"new boulder" fix
PatR [Sun, 10 Oct 2021 19:39:27 +0000 (12:39 -0700)]
"new boulder" fix

The default value for obj->corpsenm is NON_PM which is -1, so the
default value of boulder->next_boulder was non-zero instead of 0
as expected.  Because of that, boulder object formatting by xname()
was yielding "next boulder" when plain "boulder" was intended.
Until the boulder or one in a pile above it got pushed, then it
was explicitly reset.

3 years agobetter boulder pushing feedback
PatR [Sat, 9 Oct 2021 17:54:47 +0000 (10:54 -0700)]
better boulder pushing feedback

When you push a pile of boulders, describe the second and remainder
as "the next boulder" rather than just "the boulder".  Matters most
when pushing into water or lava and you keep on pushing when the
first one or more sink into the pool or plug it, but also matters
for an ordinary push where the top-most one moves successfully and
then blocks the continuation attempt to push the second one.  It was
somewhat confusing when all the messages said "the boulder" whether
they were referring to the same boulder or different ones.

Multiple pushes on the same move has always been a bit odd, but this
doesn't change that, just the feedback it generates.

3 years agofix an expanded-glyphs regression
nhmall [Sat, 9 Oct 2021 15:34:37 +0000 (11:34 -0400)]
fix an expanded-glyphs regression

Restore behavior that was unintentionally overlooked during
the expansion of glyphs earlier this year.

3 years agosimpleonames() fix
PatR [Fri, 8 Oct 2021 20:53:21 +0000 (13:53 -0700)]
simpleonames() fix

Some code from about a month back changed xname() and doname() to
only use a single 'obuf[]'.  That was to make sure that perm_invent
update also used at most one obuf.  They use some slightly convoluted
code when they called other routines which returned an obuf because
only the most recently allocated one can be explicitly released for
re-use.  That works, so I did the same for simpleonames() and
thesimpleoname() and for some reason neglected the convolution for
simpleonames().

For the case where plural was needed, it needs two obufs and tried
to release the first, which is a no-op.  So if it was used in a loop
like display_pickinv() uses doname(), it could have cycled through
all the obufs and clobbered one a caller was expecting to remember.
I'm not aware of any instances of this being an actual problem, just
happened to notice that simpleonames() was different from other
similar routines.

3 years agofixes37.0 entry typo
PatR [Fri, 8 Oct 2021 20:24:54 +0000 (13:24 -0700)]
fixes37.0 entry typo

3 years agomore DEF_PAGER
PatR [Thu, 7 Oct 2021 17:09:44 +0000 (10:09 -0700)]
more DEF_PAGER

For Unix, add internal vs external pager choice to #version.
Others always use internal pagination so don't need to see that.

Also remove obsolete "command completion" option.  I don't know
when it became unconditional but that was long enough ago to be
absent from the git log and from second cvs log included in that.

And streamline the RNG seed stuff a bit.

3 years agofix confused remove curse bug
PatR [Wed, 6 Oct 2021 20:46:27 +0000 (13:46 -0700)]
fix confused remove curse bug

Reported directly to devteam, player observed that objects on the
floor had their bless/curse state change when reading a blessed
scroll of remove curse while confused.  Message feedback mentioned
a silver saber being dropped.  I didn't attempt to view the ttyrec
playbacks; what I'm sure happened was that the saber was secondary
weapon for dual wielding and had been uncursed; the confused remove
curse effect cursed it, which in turn caused it to be dropped.  The
saber's 'next object' pointer became the [previous] top of the pile
at that spot and further object traversal intended to process the
rest of hero's inventory ended up processing floor objects there
instead.

This bug has been present for over 20 years (since 3.3.0 came out
in late 1999, when dual wielding was introduced and cursing of the
secondary weapon forced it to be dropped since making it become
welded was deemed to be too complicated) and never been reported.
Most likely players keep secondary weapons blessed so the scroll
effect doesn't touch them and simple object traversal sticks with
inventory.  Or items at the spot have unknown BUC state so having
them be affected wouldn't be particularly noticeable.

3 years agounused variable: g.restoring
PatR [Tue, 5 Oct 2021 08:57:27 +0000 (01:57 -0700)]
unused variable: g.restoring

Get rid of the last reference to 'g.restoring' (which managed to
unintentionally survive the change to 'g.program_state.restoring').

Also have suppress_map_output() check 'g.program_state.saving' and
switch the couple of checks against that flag to use the function.

3 years agofix Unix build with DEF_PAGER defined
PatR [Tue, 5 Oct 2021 08:11:24 +0000 (01:11 -0700)]
fix Unix build with DEF_PAGER defined

Eliminate a couple of compile warnings produced when DEF_PAGER is
defined:  unixmain.c: g.catmore=DEF_PAGER; wintty.c: fd=open(...).

Override its use when DLB is also defined since an external pager
could access 'license' but not 'history', 'opthelp', &c when those
are in the dlb container file.

In the commented out value for DEF_PAGER, show a viable value for
the default configuration these days.

3 years agohints/macOS.2020 - remote duplicate -DDLB
PatR [Tue, 5 Oct 2021 02:43:04 +0000 (19:43 -0700)]
hints/macOS.2020 - remote duplicate -DDLB

3 years agodisplacer monster vs long worm
PatR [Sun, 3 Oct 2021 21:15:02 +0000 (14:15 -0700)]
displacer monster vs long worm

Reported directly to devteam:  monster vs monster location swapping
didn't handle single-segment long worms properly.  Multi-segment
worms are disallowed but a worm with no visible segments (which
actually has 1 segment at the head's location) are allowed and the
segment wasn't being moved with the core monster and could trigger
warnings if sanity checking is enabled.  The next time that the
worm moved, it got itself back in synch.

I couldn't reproduce the warning but mdisplacem() clearly assumed
that a long worm reporting 0 segments didn't have any so wasn't
attempting to handle the hidden one.

3 years agocomment bit needed updating for a while
nhmall [Sun, 3 Oct 2021 13:42:32 +0000 (09:42 -0400)]
comment bit needed updating for a while

3 years agofix github issue #596 - wishing exploit
PatR [Thu, 30 Sep 2021 20:08:27 +0000 (13:08 -0700)]
fix github issue #596 - wishing exploit

for helm of opposite alignment.

Discovered and described by vultur-cadens.

The #adjust command can be used to split an object stack and if the
shop price of the two halves are different, the new stack will have
its obj->o_id modified to make the prices the same.  That could be
used to tip off the player as to what the low bits of the next o_id
will be.  Since no time passes, no intervening activity such as
random creation of a new monster can take place, so the player could
wish for something that depends on o_id with some degree of control.
Matters mainly for helms of opposite alignment intended to be used
by neutral characters since the player isn't supposed to be able to
control that.  (Other items like T-shirt slogan text and candy bar
wrapper text had a similar issue but controlling those wouldn't have
had any tangible difference on play.)

The issue writeup suggested allowing the player to specify a helm's
alignment during a wish.  That would defeat the purpose of having
o_id affect the helm's behavior in an arbitrary but repeatable way
so is rejected.

I implemented this fix before seeing a followup comment that suggests
using a more sophisticated decision than 'obj->o_id % N' for the
arbitrary effect.  This just increments context.ident for the next
obj->o_id or mon->m_id by 1 or 2 instead of always by 1 and should
be adequate.  It also has the side-effect that two consecutive wishes
for helm of opposite alignment won't necessary give one for each of
the two possible 'polarities', even with no intervening activity by
monsters, reinforcing the lack of player control.

Minor bonus fix:  it moves the incrementing check for wrap-to-0 into
a single place instead of replicating that half a dozen times.  Ones
that should have been there for shop billing and for objects loaded
from bones files were missing.

Fixes #596