]> granicus.if.org Git - nethack/log
nethack
3 years agofix "pertrified" typo
vultur-cadens [Fri, 1 Apr 2022 05:36:44 +0000 (22:36 -0700)]
fix "pertrified" typo

3 years agosengr_at() schizophrenia
PatR [Fri, 1 Apr 2022 12:22:20 +0000 (05:22 -0700)]
sengr_at() schizophrenia

sengr_at() is used as a boolean, declared as int, and returns FALSE
if there is no engraving present.  Change the declaration to boolean.

Also, using fuzzymatch() without any list of ignorable characters
just to get case-insensitve matching didn't make sense so switch to
strcmpi().

3 years agogit issue #717 - avoid putting monsters on scare \
PatR [Fri, 1 Apr 2022 12:09:58 +0000 (05:09 -0700)]
git issue #717 - avoid putting monsters on scare \

monster and Elbereth unless there's no other choice.

Suggested by NetSysFire, don't create new monsters on top of scrolls
of scare monster.  Not mentioned in the suggestion:  unless they are
a type of monster that isn't affected by such scrolls.  This extends
it to teleport destination too.

Avoid placing a monster on a scroll of scare monster or on engraved
Elbereth if there are other locations available.  Only performed for
callers of goodpos() who explicitly request it, which at the moment
are makemon(), rloc(), and enexto().

Also, propagate 'mmflags_nht' to a bunch of places that were left
using long or unsigned for makemon() and goodpos() flags.  I didn't
attempt to be systematic about that though.

Implements #717

3 years agoFix medusa levels
Pasi Kallinen [Fri, 1 Apr 2022 05:50:22 +0000 (08:50 +0300)]
Fix medusa levels

My recent commit broke medusa-3 and medusa-4, so fix those.

Make des.stair and des.ladder also accept hash-coordinate:
  des.stair("up", {8, 10});

3 years agoUse correct findtravelpath param value
Pasi Kallinen [Thu, 31 Mar 2022 14:50:00 +0000 (17:50 +0300)]
Use correct findtravelpath param value

3 years agogithub issue #715 - losing stoning resistance \
PatR [Thu, 31 Mar 2022 11:48:26 +0000 (04:48 -0700)]
github issue #715 - losing stoning resistance \

while wielding a cockatrice corpse without gloves

Reported by vultur-cadens:  if safely wielding a cockatrice corpse
without gloves due to temporary stoning resistance or wearing yellow
dragon scales/mail, having the resistance be lost to timeout or to
taking off the dragon armor should have turned the hero to stone but
didn't.

Extend the handling for taking off gloves to cover these other two
cases too.  The feedback for these deaths is usually too verbose to
fit on the tombstone but does show up in logfile.

Fixes #715

3 years agogithub issue #716 - teleporting onto pits
PatR [Wed, 30 Mar 2022 21:41:53 +0000 (14:41 -0700)]
github issue #716 - teleporting onto pits

Implement the suggestion by NetSysFire that a levitating of flying
hero won't treat pits and holes as off limits when testing potential
destinations during teleport.

Closes #716

3 years agofix #K3564 - obj sanity failure: N globs for N>1
PatR [Wed, 30 Mar 2022 21:11:29 +0000 (14:11 -0700)]
fix #K3564 - obj sanity failure: N globs for N>1

Using #name and picking an item on the floor to be assigned a type
name allowed any of the four types of globs to be named.  After
that, wishing for those by the assigned name bypassed the code that
forced the quantity to stay at 1.  Asking for "3 foo" could then
produce "3 small globs of gray ooze" which fails obj_sanity() and
issues an impossible warning (which the fuzzer escalates to panic).

The "getobj refactor" patch changed the return value of call_ok().
When it gets used to check whether an object on the floor could have
a type name assigned (rather than as a getobj() callback), the test
that should have rejected the naming attempt accepted it instead.

Update the wishing code to handle globs differently:  you can still
specify the relative size via small, medium, large, or very large,
but now you can specify a count either instead or in addition.  A
count of more than 1 is used to multiply the created glob's weight,
although it's less likely to be honored as-is when the size is bigger
than small.  Quantity is always forced to 1, at a different place in
readobjnam() than previously.

3 years agocouple of Guidebook bits: autopickup, tile_file
PatR [Tue, 29 Mar 2022 18:24:45 +0000 (11:24 -0700)]
couple of Guidebook bits: autopickup, tile_file

The change in the long-standing default for 'autopickup' warrants
mention in the Guidebook.  Also, the X11 interface can switch to
alternate tiles but doesn't use the 'tile_file' option to do so.

In Guidebook.mn, the list of options pads ones shorter than 8
characters with trailing spaces, necessitating quotes.  A few longer
ones had such quotes and even trailing spaces.  Take those away.

3 years agofixes3-7-0 typo
PatR [Tue, 29 Mar 2022 17:47:35 +0000 (10:47 -0700)]
fixes3-7-0 typo

Remove an extraneous space from a recent fixes entry.

3 years agoPrevent random stairs overwriting other terrain
Pasi Kallinen [Tue, 29 Mar 2022 15:02:24 +0000 (18:02 +0300)]
Prevent random stairs overwriting other terrain

When creating stairs in a random location in a special level lua file,
there was a chance it overwrote eg. other stairs. Make randomly placed
stairs pick locations with room, corridor, or ice terrain.

Fixes github issue #702

3 years agoslime mold comment
PatR [Mon, 28 Mar 2022 20:51:50 +0000 (13:51 -0700)]
slime mold comment

3 years agoenlightenment about temp resist and item resist
PatR [Mon, 28 Mar 2022 17:38:04 +0000 (10:38 -0700)]
enlightenment about temp resist and item resist

For timed acid resistance and timed stoning resistance, report
"You {are,were} temporarily {acid,petrification} resistant."

For items being protected by worn equipment, add "by your {armor,&c}"
similar to the existing feeback about you being protected "because
<some-reason>".  Wizard mode only.

3 years agoadjust temporary acid/stoning resistance
PatR [Mon, 28 Mar 2022 17:17:01 +0000 (10:17 -0700)]
adjust temporary acid/stoning resistance

When eating a meal that is affected by acid resistance or stoning
resistance and protected by temporary resistance, increase the timeout
so that the resistance doesn't expire until after the meal finishes.
That avoids getting the "you no longer feel safe from {acid,stoning}"
during the meal and not being affected by the dangerous food despite
that message.  Useful because the protection is checked at the start
of the meal and not rechecked during; extending the duration hides
the latter.

3 years agoitems destroyed by exploding chest
PatR [Mon, 28 Mar 2022 00:55:52 +0000 (17:55 -0700)]
items destroyed by exploding chest

From a report by a beta tester 8 years ago:  kicking a chest gave
"THUD!  The chest explodes!" but the chest remained intact.  The
explosion was destroying all floor items at the hero's spot rather
than at the chest's spot.  Fixing that results in the chest being
destroyed because it's one of the items at its own spot.

While fixing that I noticed that delobj() was only protecting the
Amulet and the invocation items from destruction, not Rider corpses.
You could destroy one or more of those by getting a trapped chest's
explosion while using a key at its spot rather than by kicking it
from adjacent.  (Getting the exploding chest result is not easy,
particuarly with positive luck.  I eventually resorted to forcing
it with a debugger.)

3 years agoSecond fix to stuck travel
Pasi Kallinen [Sun, 27 Mar 2022 07:40:50 +0000 (10:40 +0300)]
Second fix to stuck travel

There were at least two cases of travel oscillation that occurred,
even after my previous fix. To fix those, the guessing routine
would also have to consider distance to original target location.
I opted not to make that part more complex - as there was
no guarantee those changes would catch all of the oscillation cases.

Instead, when we're guessing where to move, and we would actually move
back to where we came from, stop travel, and give a message.

This should fix (and fuzzing seems to confirm) all of the travel
oscillation bugs for good, and it shouldn't affect actual good travel.
(Other than the player getting a YAFM in the occasional case of trying
to travel to a location with no travel path)

3 years agoFix travel getting stuck oscillating between two locations
Pasi Kallinen [Sat, 26 Mar 2022 21:58:25 +0000 (23:58 +0200)]
Fix travel getting stuck oscillating between two locations

There's been occasional reports (perhaps once or twice a year)
of travel getting stuck moving repeatedly between two locations
next to each other, but it has never been reproduced before.

This special level lua code fragment is a minimal test case
which triggers it:

--- special level lua fragment, indented
  des.map([[
  --##---
  ###----
  #-+----
  ####--L
  ]]);
  des.door("open", 2,2)
--- end of special level lua fragment

The open door is required.

Magic map the level. Start from somewhere NW of the door, and try
to travel to the lava pool. Hero will get stuck oscillating between NW
of the door and two steps west of the door.

Here are the maps of the travel[][] array values from findtravelpath()
in those two steps in the above map:

-------------  -------------
|  . . 2 3  |  |  . . 1 2  |
|  1 1 2 .  |  |  1 @ 1 .  |
|  @ . . .  |  |  1 . 2 .  |
|  1 1 2 .  |  |  2 . 3 4  |
-------------  -------------

There are two possible closest locations to the lava pool,
the one marked with "3" on the left map, and "4" on the right map.
Based on that alone, both would be valid places to path to.

But, in the left case, hero could not see the bottom location, so
the code won't even consider pathing to it, so it will start moving
towards the "3".

When hero moves to the second position, in the right map, now the "4"
could be seen. Now there are two possible closest locations we could
choose from. The code that scans the possible locations goes from top-left
to bottom-right, first going down (y-axis). So, the code sees the
"2" on the right. distmin() to there is 2. Good, we pick that location
to path to. Next, going down, the code considers the "4" ... which is
also equally close to the lava pool. and distmin does not consider terrain,
so ignores the door, so it has the same distmin value of "2", so the
code picks this location.

But: this was just a guess, because there's no known valid path to the
lava pool. The code loops back up to rebuild the travel[][] array
with a new starting location as the "4" from the right map, pathing
back to hero.

This is that travel array map:
-------------
|  . . . .  |
|  4 @ 3 .  |
|  3 . 2 .  |
|  3 2 1 x  |
-------------

The way travelstepx and travelstepy arrays are built means that the first
location that considers the hero's location is the "3" SW of hero, so
hero will move there next. Repeat from beginning. If there was no door,
the travelsteps would reach hero's location first from SE.

(I left the travel[][] array rebuild and travelstepx/travelstrepy build
off from the other movement position, as it's not relevant)

The fix: When considering which of the two possible closest places to the
lava pool to path to, use the one with the lowest value in the travel array.
That value is the real number of moves it takes for the hero to walk there,
so the code will consistently path to the upper location, as it is "2",
instead of considering the "4" below it.

Also some minor code reorg, so it considers couldsee first instead of
later in two separate places.

3 years agostoning resistance revisited
PatR [Sat, 26 Mar 2022 18:23:06 +0000 (11:23 -0700)]
stoning resistance revisited

It turns out that there were a bunch more monsters with the corpse-
conveys-stoning-resistance flag than just green mold.  Instead of
stripping it off, give them (including green mold) a chance to confer
timed resistance against stoning and also against acid.

All of these can convey either of those two resistances.  Like other
intrinsics obtained via eating, at most one can be obtained from any
given corpse.
  green mold, acid blob, spotted jelly, ochre jelly, black naga,
  yellow dragon, Chromatic Dragon
These can confer temporary stoning resistance but not acid resistance:
  lizard, chickatrice, cockatrice, gargoyle, winged gargoyle,
  xorn, Medusa
There aren't any that confer just acid resistance without a chance for
stoning resistance.

The effect lasts for 3d6 turns, or is extended by 3d6 more if randomly
chosen and applied when already in effect.

Having temporary acid resistance time out during another meal when
eating a corpse that ends up conferring acid resistance seems strange.
The protection against acid is granted at the start of the meal and
continues to the end (in regards to eating, not external attacks) even
when the intrinisic is lost in between.  I'm not sure whether that
needs some form of fixing, and if so, what that fixing should be.

3 years agolivelog message for breaking vegetarianism
PatR [Fri, 25 Mar 2022 20:21:07 +0000 (13:21 -0700)]
livelog message for breaking vegetarianism

Fix a minor 'fixme':  if hero breaks vegetarian conduct by eating
something made of bone, leather, or dragon-hide while polymorphed
into a shape which can eat such things, change the message from
"ate meat for first time" to "ate meat by-products for first time".

It took me a while to arrive at a sequence of actions which would
successfully test this.  You need to break foodless and vegan
conducts first, then break vegetarian with leather/bone separately
or it won't trigger a livelog event for that.  Wish for and eat a
candy bar to break vegan conduct, polymorph into a gelatinous cube,
wish for and eat leather armor, then use the #chronicle command.

3 years agoMerge branch 'fix-trap' of https://github.com/argrath/NetHack into pr712
nhmall [Fri, 25 Mar 2022 12:21:49 +0000 (08:21 -0400)]
Merge branch 'fix-trap' of https://github.com/argrath/NetHack into pr712

3 years agoMerge branch 'pr713' into NetHack-3.7
nhmall [Fri, 25 Mar 2022 12:18:01 +0000 (08:18 -0400)]
Merge branch 'pr713' into NetHack-3.7

3 years agoadd initializer on use_tinning_kit()
SHIRAKATA Kentaro [Mon, 21 Mar 2022 11:38:28 +0000 (20:38 +0900)]
add initializer on use_tinning_kit()

If poly_when_stoned() is true, an uninitialized buffer kbuf[] is passed to instapetrify().
Although instapetrify() doesn't access it in that situation for now,
it should be initialized anyway for readability.

3 years agoeating green mold corpses
PatR [Thu, 24 Mar 2022 22:49:27 +0000 (15:49 -0700)]
eating green mold corpses

A reddit posting points out that the green mold monster definition
has the flag for conveying stoning resistance but it doesn't work.
There seem to be 3 choices:
 1) implement being able to gain that resistance;
 2) take the flag away;
 3) mark green molds no-corpse so that the issue becomes moot.
The poster was hoping for (1) but I've gone with (2).  Green molds
are too common and not at all dangerous; being able to gain stoning
resistance--even with a tiny chance--could potentially be a major
change in play balance.

3 years agomazexy() again
PatR [Thu, 24 Mar 2022 18:15:37 +0000 (11:15 -0700)]
mazexy() again

Some maze code treats row y_maze_max and column x_maze_max as being
in play, other parts treat them as out.  mazexy() was doing both; the
first loop to choose a random spot allowed them, the second loop to
try every possible spot disallowed them.  Make those be consistent.

I think the extreme row and column are both expected to be solid wall
so failing to consider them might not be causing any problems.

While in there, change mazexy() to not set cc->{x,y} until it has
found a viable spot instead of potentionally making that assignment
dozens or hundreds of times.  The only difference there is that 'cc'
won't have been assigned any value if panic() gets called.

3 years agoDon't stop travel when going past a closed door
Pasi Kallinen [Thu, 24 Mar 2022 17:33:37 +0000 (19:33 +0200)]
Don't stop travel when going past a closed door

3 years agogiant ant tiles or right side of msdos display
nhmall [Thu, 24 Mar 2022 02:01:01 +0000 (22:01 -0400)]
giant ant tiles or right side of msdos display

3 years agomkstairs() sanity check
PatR [Wed, 23 Mar 2022 20:20:26 +0000 (13:20 -0700)]
mkstairs() sanity check

Complain during level creation if stairs are placed on top of anything
other than the expected room/corridor/ice terrain.  This won't prevent
the bug of upstairs and downstairs existing on the same spot (github
issue #702, also a newsgroup posting by a hardfought player) but might
at least warn players if/when that happens.

3 years agomkmaze() tweak
PatR [Wed, 23 Mar 2022 19:43:30 +0000 (12:43 -0700)]
mkmaze() tweak

This shouldn't have any effect on behavior, just make mazexy() be
a little easier to comprehend.

3 years agomove null-check on savelev()
SHIRAKATA Kentaro [Mon, 21 Mar 2022 11:31:41 +0000 (20:31 +0900)]
move null-check on savelev()

Move null-check of ttmp before its first use.

3 years agonit: Indented function end brace
Pasi Kallinen [Wed, 23 Mar 2022 10:08:46 +0000 (12:08 +0200)]
nit: Indented function end brace

3 years agofixes entry for pull request #710
PatR [Tue, 22 Mar 2022 21:31:53 +0000 (14:31 -0700)]
fixes entry for pull request #710

Pull request from entrez:  body parts for spiders and cockatrices.

Closes #710

3 years agoHandle spiders, cockatrices in mbodypart
Michael Meyer [Tue, 22 Mar 2022 19:40:13 +0000 (15:40 -0400)]
Handle spiders, cockatrices in mbodypart

Spiders and cockatrices were using the default animal_parts, which was
noticeably inaccurate in describing certain parts of their bodies.  Add
specific handling for both types of monsters: for spiders, add a
spider-specific body part list (the best I could figure out from online
sources, not being a spider anatomy expert), and for cockatrices, use
bird_parts with "scales" from snake_parts thrown in to emphasize their
unusual nature.

3 years ago"just picked up" tweaks
PatR [Tue, 22 Mar 2022 18:33:17 +0000 (11:33 -0700)]
"just picked up" tweaks

For menustyles traditional and combination, allow 'IP' to request
inventory listing of just picked up items even if not carrying any
items flagged as just picked up.  The not carrying any such items
feedback was already present but couldn't be triggered.

For menustyles partial and full, the special menu entry for 'P'
when only one item applies shows the item instead of the category
"Items you just picked up".  [That sort of thing probably ought to
be done for every menu entry rather than just for 'P'.]  Rephrase
it from
| P - <item>
to
| P - Just picked up: <item>
in case it is player's first time seeing that category be listed.

Clear the just picked up flag for any item that is dipped or read.
Lots of other actions besides drop or put-into-container probably
ought to do that too.  [Maybe even just picking an item with getobj()
could be sufficient so that it wouldn't have to be replicated all
over the place.]

3 years agoencumbrance checks
PatR [Tue, 22 Mar 2022 17:48:23 +0000 (10:48 -0700)]
encumbrance checks

I polymorphed into something wimpy and became overloaded or even
overtaxed so I dropped everything.  The status line still showed
overloaded or overtaxed until my next move.  That didn't happen in
3.6.x or 3.4.3 but I didn't pursue trying to figure out what caused
this misbehavior.

I wanted to add an encumber_msg() call to freeinv() but that would
cause message sequencing issues.  Instead, add a call to it in a
few places where items are leaving hero's inventory, particularly
for the chain of calls for dropping stuff.  I've left it off in a
bunch of other potential places.

Also add a few missing (void) casts where the return value of
existing encumber_msg() calls is being ignored.

3 years agoLua: error when supplied coordinate is not table
Pasi Kallinen [Tue, 22 Mar 2022 09:06:28 +0000 (11:06 +0200)]
Lua: error when supplied coordinate is not table

3 years agoLua: selection get and rndcoord changes
Pasi Kallinen [Tue, 22 Mar 2022 08:45:20 +0000 (10:45 +0200)]
Lua: selection get and rndcoord changes

3 years agoLua: coordinate tweaking
Pasi Kallinen [Tue, 22 Mar 2022 07:16:15 +0000 (09:16 +0200)]
Lua: coordinate tweaking

Make selection rndcoord return a table with x and y keys.
Allow (most) coordinate parameters accept such a table.
Fix selection and des lua tests broken by the above changes and
an earlier change, because selections tried to set terrain
at column 0, and it now causes a complaint.

3 years agocancelled #herecmd using time
PatR [Tue, 22 Mar 2022 01:33:34 +0000 (18:33 -0700)]
cancelled #herecmd using time

I managed to execute #herecmd by mistake and when I typed ESC to get
out of its menu, monsters took their next turn.  #therecmd behaved
similarly.

3 years agohide-under webmakers...
PatR [Tue, 22 Mar 2022 01:21:07 +0000 (18:21 -0700)]
hide-under webmakers...

Offer the chance to explicitly hide via #monster when poly'd into a
hides-under creature.  hides_under() doesn't pass the is_hider() test
so wasn't being allowed before.

If poly'd hero's monster form is both a webmaker and can hide-under,
have #monster prompt the player for which is intended.  When poly'd
hero successfully spins a web, say so.

If poly'd hero deliberately tries to hide under a cockatrice corpse,
turn to stone.

3 years agoeating food while hiding under it
PatR [Tue, 22 Mar 2022 01:11:26 +0000 (18:11 -0700)]
eating food while hiding under it

Fix the bug reported by entrez where you could end up hiding under
nothing if while poly'd into a hides-under creature and hiding under
something edible you ate whatever you were hiding under.  Same thing
could happen if it was a corpse on an altar and you offered it rather
than consumed it.

While in there, fix monsters hiding under cockatrice corpses.  They
won't do that unless there are multiple objects in the pile, but
there was no check for the possible case of all additional objects
also being other cockatrice corpses.

3 years agomax HP manipulation
PatR [Mon, 21 Mar 2022 19:32:07 +0000 (12:32 -0700)]
max HP manipulation

Life-saving has been setting u.uhpmax to max(2 * u.ulevel, 10)
and if it took place during level drain that could make u.uhpmax
increase instead of decrease, confusing healing which gets applied
to a monster who has drained the hero with Stormbringer or the
Staff of Aesculapius.  Change the setting to be max(u.ulevel, 10)
(removing the times two part) and also have level drain force it
to be set back to previous value if/when it gets increased.

Max HP loss due to strength trying to drop below 3 or to fire trap
or to being hit by Death now uses a mininum max HP of u.ulevel
rather than 1.  They don't have the alternate minimum of 10; I'm
uneasy that there are still two different minimum values.

I changed adjattrib() to set the flag to request a status update
before it gave its optional message rather than after so that the
new characteristic value would be visible during the message.  That
resulted in not updating status when eating royal jelly changed HP
or max HP after boosting strength.  But the same missing update
would have occurred--or rather, failed to occur--without the change
in sequencing if the strength boost causes a change in encumbrance.

3 years agopull request #708 - logging of first hit
PatR [Sun, 20 Mar 2022 01:03:01 +0000 (18:03 -0700)]
pull request #708 - logging of first hit

Pull request from entrez:  the log message "hit with a wielded weapon
for first time" for breaking the "never hit with a wielded weapon"
conduct wss being given when hitting with wielded non-weapons.  Since
the conduct remained unbroken in that situation, the 'first hit'
message would be re-logged for subsequent non-weapon hits.  This bug
was not present in initial livelog implementation; it was introduced
by the change to log first-hit before first-kill when those occurred
on the same attack.  Verify that the wielded object is actually a
weapon or weapon-tool when deciding whether to log first-hit event.

Closes #708

3 years agoFix: repeated 'hit with a wielded weapon' logging
Michael Meyer [Sat, 19 Mar 2022 19:33:13 +0000 (15:33 -0400)]
Fix: repeated 'hit with a wielded weapon' logging

The "hit with a wielded weapon for the first time" livelog line could be
produced repeatedly: it was triggered by hitting a monster with a
wielded object of any sort, but the u.uconduct.weaphit counter was only
incremented if hitting with an actual 'weapon' (a WEAPON_CLASS or
is_weptool item).  As a result, if a non-weapon-using hero whipped out a
non-weapon item -- a cockatrice corpse, for example -- and started going
to town on some monsters, the livelog message would be repeated with
every hit.

3 years agoun-streq followup
nhkeni [Sun, 20 Mar 2022 00:49:00 +0000 (20:49 -0400)]
un-streq followup

3 years agomenuinvertmode for win32/Windows GUI
PatR [Sat, 19 Mar 2022 22:49:55 +0000 (15:49 -0700)]
menuinvertmode for win32/Windows GUI

Catch up with tty, curses, X11, and Qt:  menuitem_invert_test()
applies to select as well as invert and if menuinvertmode is 2 then
it also applies to unselect.

Not tested.

3 years agomenuinvertmode for Qt
PatR [Sat, 19 Mar 2022 22:32:31 +0000 (15:32 -0700)]
menuinvertmode for Qt

Catch up with tty, curses, and X11.  Items flagged as skip-invert
will not be toggled On by select-all.  If menuinvertmode is 2, they
also won't be toggled Off by unselect-all.

3 years agomenuinvertmode on X11
PatR [Sat, 19 Mar 2022 22:09:20 +0000 (15:09 -0700)]
menuinvertmode on X11

Catch up with tty and curses.  Menu items flagged as skip-invert will
not be toggled On by select-all and select-page.  If menuinvertmode
is 2 they also won't be toggled Off by deselect-all and deselect-page.

3 years agomenuinvertmode on curses
PatR [Sat, 19 Mar 2022 19:49:43 +0000 (12:49 -0700)]
menuinvertmode on curses

Change curses' use of menuitem_invert_test() to match the recently
changed tty behavior:  when menuinvertmode is 1 the test excludes
special menu items that are flagged 'skip-invert' while handling
select-all and select-page as well as invert-all and invert-page,
and when that option is 2 then it also operates on deselect-all and
deselect-page.

3 years agopull request #707 - add missing (void) casts
PatR [Sat, 19 Mar 2022 16:10:47 +0000 (09:10 -0700)]
pull request #707 - add missing (void) casts

Incorporate pull request from argrath.

Closes #707

3 years agoAdd explicit cast to void
SHIRAKATA Kentaro [Wed, 16 Mar 2022 13:45:39 +0000 (22:45 +0900)]
Add explicit cast to void

All other these calls not using a return value have a cast.

3 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhkeni [Sat, 19 Mar 2022 00:34:59 +0000 (20:34 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

3 years agoReplace streq() with str_start_is(), which actually has the intended semantics.
nhkeni [Sat, 19 Mar 2022 00:33:13 +0000 (20:33 -0400)]
Replace streq() with str_start_is(), which actually has the intended semantics.
Contributed by Michael Meyer.

3 years agoFix dmonsfree pending when hero was hit with drain-life artifact
Pasi Kallinen [Fri, 18 Mar 2022 16:33:32 +0000 (18:33 +0200)]
Fix dmonsfree pending when hero was hit with drain-life artifact

When a monster hit hero with an artifact with drain-life attack
(Stormbringer or The Staff of Aesculapius), and hero lost a level
and hero had more max hp in the lower xp level, the math made the
attacker lose hp. This could put the monster hp in the negative,
causing "dmonsfree: 1 removed doesn't match 0 pending"

3 years agoAdd helpless monster macro
Pasi Kallinen [Fri, 18 Mar 2022 08:19:04 +0000 (10:19 +0200)]
Add helpless monster macro

3 years agoCollisions while hurtling can stone participants
Michael Meyer [Fri, 18 Mar 2022 00:04:58 +0000 (20:04 -0400)]
Collisions while hurtling can stone participants

Hurtling into a monster is described as "bumping into" it, so it makes
sense that hurtling willy-nilly into a cockatrice (or vice-versa) could
result in petrification.  Since hurtling for the hero usually involves
"floating in the opposite direction" (presumably backwards) after
throwing an item, check whether the hero is wearing any body armor which
would cover their torso rather than looking for gloves.  Do the same for
monsters on the general basis that it's a bodily collision, and for the
sake of consistency.

3 years agotile2x11.c needs a local copy of FITSuint_ for alloc.o
nhkeni [Fri, 18 Mar 2022 00:20:39 +0000 (20:20 -0400)]
tile2x11.c needs a local copy of FITSuint_ for alloc.o

3 years agotile2bmp.c needs a local copy of FITSuint_ for alloc.o
nhkeni [Thu, 17 Mar 2022 23:27:02 +0000 (19:27 -0400)]
tile2bmp.c needs a local copy of FITSuint_ for alloc.o

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