Commit Graph

15437 Commits

Author SHA1 Message Date
PatR
1b79f00a39 more PR #1077 - #sit on floor trap while Flying
Sitting on a squeaky board wasn't triggering it even after the
handler for that type of trap allowed VIASITTING to override Flying.
The check_in_air() test for floor traps didn't have the same override,
so the squeaky board handler didn't get called.

This fixes that, which led to inconsistency with some other trap
types, and additional fixes for pits and bear traps.  There might be
others that still behave oddly.  For example, if flying over a hole,
using #sit yields
 |You land.  There's a gaping hole under you!  You don't fall in.
I think that's a message phrasing issue rather than a falling trap
issue; if you want to go down, use '>' instead of #sit.  On the other
hand, you do now fall into pit traps for #sit while flying over them.
2023-07-09 14:51:30 -07:00
PatR
a0c481c2f9 fixes entry for PR #1077 - #sit while flying
Pull request from Ardub23:  trigger a squeaky board trap if flying hero
uses #sit while over it.

Supersedes #1067
Closes #1077
2023-07-09 13:40:28 -07:00
Ardub23
6406c9d055 Sit to trigger squeaky board even if flying
If the hero deliberately sits on the floor while flying over a squeaky
board, then either they're trying to squeak it on purpose or they haven't
noticed it. Either way, sitting should trigger it.
2023-07-09 09:28:09 -06:00
PatR
7b32ce02ea fix github issue #1072 - pets pick up cursed items
Issue reported by vultur-cadens:  tame monsters capable of using items
would pick up cursed ones and even wear cursed armor.

The report cites commit 6c9700ab25 but
I don't see any reason why it would be the cause.  However, I was able
to reproduce the misbehavior and this commit seems to fix it.

Fixes #1072
2023-07-08 15:24:40 -07:00
PatR
8948ad0327 fixes entry for PR #1069
Pull request from vultur-cadens:  writing an unknown spellbook will
succeed if corresponding spell is well known (feasible via divine gift
in 3.7 or object amnesia in earlier versions).  When nearing the point
of fading from memory, Luck is still required but non-wizards only
need the much lower wizard amount.  If already forgotten, the chance
to write the book remains the same as if the spell wasn't known.

Closes #1069
2023-07-07 12:20:04 -07:00
vultur-cadens
72213bf48f writing an unknown spellbook when the spell is known
Allow hero to write an unknown spellbook if the spell is freshly known
(from divine knowledge).  If the spell is going stale, the chance of
successfully writing the spellbook depends on Luck, but only rnl(5)
(like a Wizard) instead of rnl(15).  Forgotten spells do not help when
writing unknown spellbooks.
2023-07-07 12:13:52 -07:00
PatR
78a2260830 fixes entry for PR #1057 - altars vs pits
Pull request from entrez:  pits created by breaking a wand of digging
or applying a drum of earthquake used to be able to destroy altars
but a change to prevent placing traps on 'furniture' unintentionally
caused that to stop working.

Closes #1057
2023-07-07 10:45:13 -07:00
Michael Meyer
ab37888b36 Restore altar destruction from magical digging
Especially powerful magic is meant to be able to destroy altars
(breaking a wand of digging or using a drum of earthquake), but it was
being blocked by a check added to maketrap() in a7f6460 designed to
prevent wizard-mode trap wishing from overwriting stairs.  The check was
refined in 6a3d82c to add an exception for digging up graves, but
continued to prevent the destruction of other types of
previously-destructible terrain.

Since this block was a side effect of an attempt to add some guard rails
to wizmode terrain wishes, and the code to explicitly permit the
destruction of other furniture with especially powerful magic is still
present, it doesn't seem like it was actually intended.  Open up terrain
destruction by digging magic a bit more by excluding only
non-destructible terrain, not all furniture other than graves, from
being overwritten by pits and holes.

Also, use AM_SANCTUM to more precisely identify non-destructible high
altars in dig_check() rather than checking whether the hero is on the
Astral or Sanctum levels.
2023-07-07 10:41:18 -07:00
PatR
b914f79c2f fixed entry for PR #1051 - water-vault escape item
Pull request from entrez:  when creating a detached theme room of type
"water-surrounded vault", make sure that one of the chests contains an
item that could be used to escape from the room in case hero arrives
via trap door or [level] teleportation.

Closes #1051
2023-07-07 09:50:57 -07:00
Michael Meyer
95b410ee94 Provide escape item in water-surrounded vaults
Water vaults are one of the few places that can/will generate completely
sealed off in a normal level.  Other such spots are designed to provide
a guaranteed means of escape (vault guard, scrolls of teleportation in
niches, etc) -- water vaults were an exception that didn't do this, so a
hero who fell into one from above could have ended up in a position
where she had no choice but to wait to starve to death or #quit. Provide
an escape item in one of the vault's chests to give a hero more options
in that position.

Also fix a minor mistake (I'm pretty sure, though I'm not a Lua expert
enough to be certain) in an nhlib.c comment describing how to use
obj.addcontent() -- when called as box.addcontent(contents) as the
comment suggested it produces an error, but works OK when called as
box:addcontent(contents) or obj.addcontent(box, contents).
2023-07-07 09:42:43 -07:00
PatR
60a3263a85 fix github issue #1070 - Minetown achievement
Issue reported by vultur-cadens:  arriving on the Mine Town level
via falling or level teleport won't register the "entered Minetown"
achievement if hero doesn't arrive inside a room.

Reorder some code in check_special_room() so that town entry will be
tested before the early return if no room entry has occurred.  This
adds 'level.flags.has_town' to make the town test be cheaper when
the hero hasn't attained the achievement yet and is wandering around
the mines.

Fixes #1070
2023-07-06 13:18:19 -07:00
nhmall
2bba306348 default fetch-lua to https
Also add an alternative fetch-lua-http target to use http (via port 80)

Resolves #1074
2023-07-05 19:18:48 -04:00
nhmall
7c26410daf adjust hints/{linux,macOS}.370 for absence of pkg-config 2023-07-05 09:07:13 -04:00
PatR
c360822c89 github PR #1052 - levltyp[] re-synchronization
Pull request from entrez:  the legend for wizard mode #terrain wasn't
updated to include terrain type "lava wall", so the entries for it
and everything that followed were inaccurate.

I've expanded the comment about level type codes in rm.h.

Closes #1052
2023-07-04 23:17:30 -07:00
Michael Meyer
3064228ca7 Fix: levltyp[] desynchronization
The "temporary?" levltyp[] array became desynchronized from the level
types enum with the addition of lava walls.  This caused all level types
past that to be given the wrong description when it was used.

Add an explicit length to the array so that future additions to the enum
should produce a compiler warning if it's not updated at the same time.
2023-07-04 22:56:52 -07:00
PatR
d119a91799 github PR #1050 - plural of Cyclops
Pull request from entrez:  plural of Cyclops should be Cyclopes
but nethack was constructing Cyclopses.

Closes #1050
2023-07-04 22:38:13 -07:00
Michael Meyer
d57a359bba Add correct Cyclops pluralization
The correct plural of "Cyclops" is "Cyclopes", not "Cyclopses".  I don't
know if anyone would actually use that as a fruitname, but it wouldn't
hurt to add it -- especially since a Cyclops does appear in the game.
2023-07-04 22:37:38 -07:00
PatR
12ca114e96 github PR #1036 - split dosacrifice()
Pull request from argrath:  split #offer of fake Amulet of Yendor
out of dosacrifice() into a separate routine.

Closes #1036
2023-07-04 22:20:39 -07:00
SHIRAKATA Kentaro
97edd4b845 split offering fake amulet into separate function 2023-07-04 22:19:04 -07:00
PatR
060398abec github PR #1023 - extrinsics vs intrinsics rumor
Pull request from Kufat:  add a true rumor hinting about extrinsics
sometimes being 'better' than intrinsics.

Closes #1023
2023-07-04 22:15:18 -07:00
Kufat
66d0c47951 Add true rumor re. intrinsics/extrinsics
Some extrinsics (telepathy, speed) are more powerful than their intrinsic versions.
2023-07-04 22:09:20 -07:00
nhmall
1c8a5d62bc suppress four new warnings
src/sp_lev.c(5348) : warning C4702: unreachable code
src/sp_lev.c(5608) : warning C4702: unreachable code
src/sp_lev.c(6281) : warning C4702: unreachable code
src/sp_lev.c(6334) : warning C4702: unreachable code
2023-07-04 23:44:36 -04:00
PatR
8a3a5c0c9f fix PR #1034 - special level bullet proofing
Pull request from copperwater:  if a special level's lua file
specified invalid coordinates for some things, the code in sp_lev.c
might use them instead of rejecting them.  This could lead to severe
problems.  Presumeably the existing special levels aren't affected
by this.

Closes #1034
2023-07-04 16:23:53 -07:00
copperwater
0e01828ed8 Fix: when a themeroom failed, xstart/ystart weren't reset
Revealed this bug when testing the previous commit:

Themed room generation with a randomly placed map involves picking a
single random point on the map at which to plop it down, and then
declaring the themed room failed and exiting if it would go beyond the
map bounds or overlaps with an existing room. In the process,
xstart/ystart/xsize/ysize have been modified, but weren't getting reset.
(They would get reset if the map successfully got placed and it had a
contents function, as of commit 4af086b, but there wasn't handling for
the failure to place it.)
2023-07-04 16:19:28 -07:00
copperwater
2ae5ce8ab3 Fix and guard against out-of-bounds writes in splev code
I traced a memory corruption bug in xNetHack to a themed room that
looked something like this:

    function()
       des.room({ type="themed", contents = function()
          des.feature({ type='sink' })
          ...
       end })
    end

Placing a feature at a random spot within a room or region is a
reasonable thing for the parser to handle, but the code was not equipped
to handle it, and so the unspecified x and y set as -1 got passed
directly to SP_COORD_PACK, ending up as coordinates way off the map.
Since sel_set_feature does not do an isok() check, this ended up writing
data to unrelated memory.

This commit does the following things:

- Enables des.feature() with no coordinates specified, both via a table
  with 'type' set, and as the single string argument. When no
  coordinates are specified, it will pick a random normal-floor spot
  within the enclosing room or region if there is one, or anywhere
  on the level if there isn't.
- Prevents sel_set_feature from corrupting memory outside
  g.level.locations. Additionally, if EXTRA_SANITY_CHECKS is defined and
  this gets attempted, it causes an impossible.
- Guards the existing "door coord not ok" Lua error with an immediate
  return from lspo_door.
- Adds similar "coord not ok" errors to all the other locations in
  sp_lev.c which did not already check for a unspecified/invalid
  coordinate and for which a random coordinate is nonsensical:
  des.terrain(), des.drawbridge(), and des.mazewalk().
2023-07-04 16:19:27 -07:00
PatR
c016f70a0d pull request #1033 - builds_up()
Pull request from copperwater:  address a 'FIXME' in the code that
didn't have any affect on nethack but did affect xnethack.

Closes #1033
2023-07-04 16:07:24 -07:00
copperwater
9e291234f5 Implement builds_up correctly, resolving its FIXME
The FIXME comment noted that builds_up would return an incorrect false
value for a dungeon branch that builds upwards but is only 1 level, but
that this is a latent problem because no such branch exists in NetHack.
Such a branch does exist in xNetHack, and it causes the debug fuzzer to
crash ("mon_arrive: no corresponding portal" because it can't find the
correct-direction stairs), so I figured I might as well fix it upstream.
2023-07-04 16:05:52 -07:00
PatR
bd9ff5cda6 fixes entry for PR #1032 - des boolean 'trapped'
Pull request from copperwater: accept 'true' or 'false' (also 'yes'
or 'no') in des.object specification for 'trapped'.

After resolving a merge conflict one diff band of this went away, but
the settings of otmp->otrapped from o->trapped and otmp->greased from
o->greased without it look ok to me.

Closes #1032
2023-07-04 15:46:58 -07:00
copperwater
cba85d2314 Allow des.object "trapped" field to be a boolean
I thought there were more object fields that currently only accept ints
but ought to accept booleans, but when I checked I found that most of
them do already, and the ones that take ints are the ones that the
number carries meaning (spe, recharged, etc).

Except for trapped. In struct obj, otrapped is a 1-bit flag, so there's no
good reason for the level parser to treat it as a type error if someone
intuitively makes a des.object call with trapped=true or trapped=false.
Change it to an optional boolean argument, like the other boolean flags
(locked, greased, etc).

Note that get_table_boolean_opt still accepts ints, so existing uses of
trapped=0 or trapped=1 won't be affected.
2023-07-04 15:38:26 -07:00
PatR
34f91484fb fixes entry for PR #1031 - lua: subtract and xor
Pull request from copperwater:  selection subtract and selection xor
didn't work as intended.

Closes #1031
2023-07-04 14:55:45 -07:00
copperwater
c6fa9c3099 Fix chained selection xor and subtraction operations
Something that's reasonable to expect to see in Lua files is something
like:

    local sel4 = sel1 - sel2 - sel3

or more generally, producing a selection from subtraction that will then
be used in subsequent selection math.

I discovered this wasn't actually working correctly, and that it also
applied to the xor operation. The reason behind this is that
l_selection_sub and l_selection_xor create a new selection from nothing,
which by default has "lower" bounds of COLNO, ROWNO and "upper" bounds
of 0,0. Iterating across the intersecting rectangle of both selections
does not reliably set the bounds of the resulting selection properly,
since the first selection_setpoint with a value of 0 will cause the
selection's bounds_dirty flag to be set, at which point they will cease
to change as more points are added.

Then this selection with its incorrect boundaries is pushed back onto
the Lua stack, and becomes the first operand of the next subtraction
(i.e. selr in the first l_selection_sub becomes sela in the second
l_selection_sub). Depending on how broken the bounding box is, results
may vary, but if the bounding box is still (COLNO,ROWNO,0,0), the
resulting selection will have no points selected at all.

This fixes this problem by forcibly recalculating the bounds of the
result selection, so any subsequent operations on it will be valid.
2023-07-04 14:53:16 -07:00
nhmall
6e3ccaa8a5 notes about some header files
The gist of this appeared previously in the commit message for
b722cf99.
2023-07-04 09:53:51 -04:00
PatR
0e97f8901a glyph_to_cmap() usage
I was looking to see what the impact of converting glyph_to_cmap() to
a function might have and noticed a couple of places where the macro
edition is passed a non-trivial argument.  Since it evaluates that
argument many times, there is hidden overhead.  Fetch the glyph once
and pass that to glyph_to_cmap().

This will no longer be very useful--but won't need to be reverted--if
PR #1022 gets incorporated.

do_positionbar() has bugs (only matters for MS-DOS).
2023-07-03 13:24:56 -07:00
nhw_cron
47acc3da39 This is cron-daily v1-May-8-2022. 000files updated: Files 2023-07-03 13:07:35 -04:00
nhmall
1db6bb0438 update submodules/pdcursesmod 2023-07-03 13:05:28 -04:00
nhmall
be1be16458 outdated file 2023-07-03 11:51:06 -04:00
nhmall
e75535497b add support for mips cross-compile to *.370 hints
Also close #1041
2023-07-03 11:44:50 -04:00
nhmall
81dedbe298 stick with submodule commit defined in repository
Use the submodule commit already defined in the repository
on submodule update, rather than pulling the most recent commit
in Makefiles.
2023-07-03 11:27:40 -04:00
PatR
2d6d151b28 PR #1009 - higher statue trap difficulty
Pull request from NulCGT:  make statues created for statue traps be
5 to 10 points higher in difficulty than the default would be.

5 to 10 points of difficulty higher is already used for figurines.
The pull request chose the same amount but I've reduced it to 3 to 6.
Partly so that they won't be the same, partly so that they won't be
too hard when activated, and partly so that the creature won't be
quite as obvious a give away that the statue is a trap.

Closes #1009
2023-07-02 15:27:58 -07:00
Kestrel Gregorich-Trevor
2dd0af630e Adjust statue traps to be biased toward more difficult monsters. 2023-07-02 15:16:57 -07:00
PatR
5daec07300 PR #1008 - get doppelganger form from 'record'
Pull request from NulCGT:  when a doppelganger is choosing to become
a fake player, get role from an entry in the high scores file.  Use
that entry's name too if the doppelganger is within view at the time.

I'm not sure how well this will work for a single user score file if
the player always runs the same role and name.  I've given it a small
chance (1/13) to ignore the topten and stay with random role instead.

Closes #1008
2023-07-02 14:58:11 -07:00
Kestrel Gregorich-Trevor
8e43b684e8 Doppelgangers mimic top ten list members.
I saw this in the YANI archive, and I think it's fairly interesting.
Doppelgangers are known for commiting identity theft, but in NetHack
they function as just another shapeshifter. This commit makes them
a bit more interesting, I think.

Original YANI by aosdict and Andrio.
2023-07-02 14:43:29 -07:00
PatR
ad01b23090 mondead() uncluttering
Pull request #1005 introduced some code that needed minor reformatting.
This goes beyond that, splitting the livelog/#chronicle handling and
the vampire unshifting code out of mondead() into separate routines.

The livelog phrasing for death of a unique monster always assumed that
the hero was directly responsible:
 "killed|destroyed <unique mon|shk+details> (Nth time)."
If it dies while monsters are moving, switch to:
 "<unique mon|shk+details> has been killed|destroyed (Nth time)."
It isn't phrased as if the hero is responsible if the monster dies due
to passive counter-attack against poly'd hero but that isn't blatantly
wrong and doesn't seem worth worrying about.
2023-07-02 11:58:13 -07:00
PatR
99c1bf10ee pull request #1005 - livelogging shopkeeper deaths
Pull request from vultur-cadens:  issue a livelog/#chronicle message
the first time any given shopkeeper dies.

Closes #1005
2023-07-02 02:42:38 -07:00
vultur-cadens
a1df88d565 livelog shopkeeper deaths
The livelog message includes the shopkeeper's shop type, since the
livelog for stealing also mentions the shop type.

Only the first kill per shopkeeper is logged.
2023-07-02 02:14:15 -07:00
nhmall
02343aa43b fixes entry for Windows setlocale issue 2023-07-01 09:34:56 -04:00
nhmall
5e34883f36 windows: more setlocale 2023-07-01 09:24:57 -04:00
PatR
43079cf72f paranoid_confirm menu followup
The command name is expected to be short and the menu description is
expected to be short, but use a bigger buffer for the combination of
the two just in case.
2023-06-30 16:54:43 -07:00
PatR
b05bc01061 paranoid_confirm menu
In the paranoid_confirm submenu for 'm O', dynamically substitute the
correct key into the description of the 'swim' choice if #reqmenu is
bound to something other than 'm'.
2023-06-30 16:44:14 -07:00
PatR
9212ae75f8 tentative fix for issue #1026 - Enhanced1
Issue reported by ostrosablin (and mentioned previously but I still
I haven't remembered where):  loading a roguesymset removes any utf8
data that has been set up for primary symset.  The curses interface
explicitly initializes roguesymset to the default set and if config
file has specified OPTIONS=symset:Enhanced1 (or some other uft8 set
if someone adds such), that stays the active set but no longer gets
rendered with the intended symbols.

I have no idea whether having symset and roguesymset both use uft8
with different symbols and/or colors works at all and if so whether
it will still work after this revision, but this prevents loading one
set with non-utf8 while the other still uses utf8 from clearing out
the cached utf8 data.

Closes #1026
2023-06-30 12:55:33 -07:00