Commit Graph

17686 Commits

Author SHA1 Message Date
PatR
1928a3e12b get rid of trailing space in generated tile.c 2025-01-10 01:40:02 -08:00
PatR
a490ce5759 remove trailing spaces from src/*.c, include/*.h 2025-01-10 01:30:49 -08:00
PatR
5d7d004846 fix issue #1352 - another try at #1339
The attempt to simplify shop handling of containers keeps getting
more complicated.

Fixes #1352
2025-01-09 21:40:46 -08:00
Pasi Kallinen
de38ce2c90 Fix vision: force bolt breaking door with temp cloud 2025-01-09 19:44:21 +02:00
Pasi Kallinen
843b02ec1d Add vision sanity checking, fix more vision
- Add a vision sanity checking routine

- Recalc block point when digging a door for temporary clouds

- Add recalc_block_point after cvt_sdoor_to_door, because doorways
  on the Rogue level have no doors, and otherwise the sanity checking
  would complain.  This doesn't actually change how the Rogue level
  vision works, as it uses a different vision system

- Monster using a trap in a secret corridor revealed the corridor,
  but didn't unblock the vision unless you saw the location
2025-01-09 17:28:24 +02:00
PatR
83c0d430c9 suppress sanity_check after invalid command
Entering an invalid command, particularly <space>, while there is
some circumstance triggering sanity check warnings, becomes too
verbose.
2025-01-08 13:46:28 -08:00
Pasi Kallinen
c956e3e215 Fix vision when applying a wand of digging 2025-01-08 13:59:50 +02:00
Pasi Kallinen
256b820fe3 Fix impossible no_charge obj in untended shop
Sanity checking was complaining about a no_charge obj in untended shop.

Angry shopkeeper was accepting thrown items as no_charge objects:
To reproduce the impossible, kick down the shop door angering
the shopkeeper. While the shopkeeper is still in their shop,
throw an item they don't want into the shop. Wait for the shopkeeper
to get out of the shop.

Move the anger checking before the sell auto-accept code,
so the shopkeeper will charge for the object.
2025-01-08 12:59:08 +02:00
nhw_cron
9b71efe69e This is cron-daily v1-Apr-1-2024. 005manpages updated: recover.txt 2025-01-07 11:52:43 -05:00
nhmall
06e0eb0616 Merge pull request #1351 from https://github.com/g-branden-robinson/NetHack into NetHack-3.7 2025-01-07 10:43:37 -05:00
Pasi Kallinen
ae1a86d7be Fix vision when door is destroyed by ray effect
A door was destroyed and vision unblocked without considering
temporary (poison) clouds.
2025-01-07 17:39:46 +02:00
nhmall
85965b1b32 Visual Studio project files:directory name cleanup 2025-01-07 10:00:28 -05:00
Pasi Kallinen
b27c9102f6 Fix vision when opening a door
If a monster or hero opened a door with a temporary (poison) cloud
on it, the location could be seen through even with the cloud.
2025-01-07 15:14:27 +02:00
Pasi Kallinen
108d975694 Fix vision in guard created corridor
... when hero angers the guard, the guard's previous location
didn't get the vision blocking fixed.
2025-01-07 10:52:01 +02:00
PatR
a118869262 rephrase a recent fixes entry 2025-01-06 11:01:18 -08:00
Pasi Kallinen
f4cd5ed065 Fix vision with pushing a boulder and temp clouds
remove_object cleared the vision when the last boulder was removed
from a location, without considering temporary [poison] clouds.
This particular case happened when pushing a boulder.
2025-01-06 20:22:56 +02:00
Pasi Kallinen
274b15cd77 Fix vision when xorn digs down on a wall
A xorn inside a wall using a wand of digging to dig down, the vision
was still blocked at that location.
2025-01-06 20:11:35 +02:00
Pasi Kallinen
4392f5fa4e Fix vision in some cases with boulder falling into pool
We can't just unconditionally unblock vision for a location when a boulder
falls into a pool, because the location may also have a (poison) cloud on it.
2025-01-06 19:46:38 +02:00
nhmall
d807436c10 Windows: broken saved game restore
Apparently, restoring of saved games on Windows has been
broken since 1f36b98b, 'selectsaved' extension from Oct 10.
That change was altering the names of the files saved on disk
to a new format introduced at that time, but the game was not
opening a savefile with that same name, and the restore failed.

The code that renamed the savefile to match the internal name
was not part of 1f36b98b, it already existed prior to the new
internally-stored format.

To get things functional, this commit disables the code that
carries out the renaming of the on-disk savefile to match the
internal name in the savefile entirely, at least for now.

This relates to GitHub issue #1346 item 2.
2025-01-06 03:28:44 -05:00
nhmall
7cc118365c quiet down mips cross-compile
Even though most of these are cast to void (but not all), the
mips cross-compiler seems determined to warn about them anyway.

Suppress that particular warning altogether to quiet the build.
That is not the ideal approach, but if the normal way of whitelisting
individual cases isn't working, I'm not sure of another course of
action.
2025-01-05 15:51:11 -05:00
PatR
b2c108b416 teleporting of engulfer
Commit ba731a346b "fix shop steal when
teleporting your engulfer" mentioned that there was no longer any
message given if engulfer+hero got teleported.  Add such.  It is a
bit lame but the situation is rare enough that it should suffice.
2025-01-05 10:19:31 -08:00
Pasi Kallinen
57bf003c26 Fix rolling boulder not unblocking sight at wall of water
A rolling boulder that destroys a wall of water did not unblock
the vision at that point.
2025-01-05 13:35:21 +02:00
nhmall
a7152ad54e CROSS_TO_WASM build fix
A couple of option processing functions, one of which was called in file.c, were
recently added to sys/unix/unixmain.c, but the wasm build does not include unixmain.c,
it uses sys/libnh/libnhmain.c.

Transcribe the functions into sys/libnh/libnhmain.c.

Also, do not #include "wintty.h" for NOTTYGRAPHICS builds.
2025-01-05 05:42:24 -05:00
nhmall
ffadd254d7 follow-up: missed comment and an outdated interface 2025-01-04 23:51:34 -05:00
nhmall
be5143bb74 window-port updates
Remove start_screen() and end_screen() from the
Window-port interface.

They were only ever used by tty, and there was a comment
carried to several window-ports about how they "really
should go away. They are tty-specific"

term_start_screen() and term_end_screen() are part of
terminal/NO_TERMS supporting routines now.
2025-01-04 23:38:34 -05:00
nhmall
63dfb84d00 follow-up: whitespace clean-up for wintty.c
Some tabs to spaces.

Also restore a comment that was inadvertantly deleted.
2025-01-04 19:32:06 -05:00
nhmall
428665c613 fixes entry update for another part of commit 37758c7e 2025-01-04 19:16:02 -05:00
PatR
b767e1e070 missing gw.wasinwater comment 2025-01-04 16:03:56 -08:00
nhmall
37758c7e48 some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
2025-01-04 19:01:34 -05:00
PatR
7982c72e8b fix github issue #1360 - autounlock=Kick
Issue reported by ostrosablin:  having Kick enabled as one of the
values for the 'autounlock' option succeeded it prompting "kick it?"
when walking into a locked closed door, but answering "yes" behaved
the same as answering "no".

There's bound to be a better way of fixing this, but this works.

Fixes #1360
2025-01-04 13:59:06 -08:00
copperwater
2a50234565 Remove dented pot encyclopedia matching on 'helmet'
Dented pots got their own encyclopedia entry, so they shouldn't still
match to "helmet". Even without this change, they match the "dented pot"
entry correctly, but only by virtue of it appearing earlier in the
encyclopedia.

Inverting the match to "~dented pot" isn't necessary since it isn't
something that would otherwise match "helmet", so just remove it.
2025-01-04 16:48:05 +02:00
copperwater
e8ad3b4c19 Fix: quantum mechanics' tele attack had inverted negation check
Noticed when I summoned a quantum mechanic in wizard mode with a
starting character who should have no armor protection against their
teleport attack, but every touch resulted in "You are not affected". It
turns out the if statement checking for armor protection is backwards,
so you were never affected when you have no protection and were almost
always affected when you had good protection.

This appears to date back to when the all-purpose 'negated' variable was
removed and "You are not affected" moved to after the negation check;
the new conditional kept the ! by mistake.
2025-01-04 16:46:22 +02:00
Pasi Kallinen
1ef3167ca0 Steed #monster breath feedback
Using #monster to make the steed use the breath weapon often
failed because the steed did not want to breathe at weak or
too strong monsters.
Make #monster force the steed use the breath, and if there is
no targets available, make the steed make some noise as feedback.
2025-01-04 16:37:14 +02:00
Pasi Kallinen
2ebe8915f6 Prevent melting ice destroying necessary traps
A magic portal ended up on a melting ice.
2025-01-04 16:05:07 +02:00
Pasi Kallinen
9313fb7747 Clear tin-eating struct when object goes away
The tin-eating context was pointing to a non-existent object,
causing an error when the fuzzer somehow managed to continue eating
the freed tin object.
Clear the pointer when the tin leaves inventory or the object
is deleted.
2025-01-03 22:21:14 +02:00
Pasi Kallinen
ba731a346b Fix shop steal when teleporting your swallower
Picking up a shop item and not paying it, getting swallowed
by a monster, and then teleporting the monster out of the shop
with you in it, the shopkeeper didn't notice the theft.
But the object was not marked as paid either.

Also prevent giving a message of the swallower disappearing
and appearing when it was teleported.  (Although now there's
no message given, so something should be added ...)
2025-01-03 20:58:26 +02:00
PatR
bf3654dbe2 \#wizintrinsic bit 2025-01-03 08:33:03 -08:00
PatR
ce947600e5 discoverying water walking boots
If water walking boots haven't been discovered yet and underwater
hero rises to the surface when putting a pair on, discover them.

(Sinking while removing such on water already discovers them.)
2025-01-02 23:12:15 -08:00
nhmall
d3c57e1b42 fix reported crash of TTY_PERM_INVENT segfaulting
Options processing can be early, even before ttyDisplay is allocated.
If we find that TTY_PERM_INVENT initialization is happening too early,
just set a marker (iflags.perm_invent_pending) to try again a bit later.

The changes in win/share are just to be able to sucessfully
reproduce the original issue on Windows. It was easily reproduced
on Unix, just by building with TTY_PERM_INVENT in include/config.h
and setting OPTIONS=perm_invent in config file.
2025-01-02 11:46:15 -05:00
copperwater
2d4f9893ad Enable more ways to specify monster inventory in special levels
This originated with a bug in NerfHack in which the developer specified
an inventory for a quest nemesis, but neglected to include the Bell of
Opening in it. Since monsters' inventory contents from makemon() were
tossed out completely, this caused a situation where the Bell was
deleted and the game was unwinnable. The first part of this change is
guarding against that by adding mdrop_special_objs before discarding the
inventory. This does create a possibility where if the programmer *does*
specify a nemesis get the Bell item in their inventory, while neglecting
to remove its special case generation in makemon.c, it would generate
twice - but two Bells is better than none.

Working on that fix led me to think about a limitation of the current
sp_lev.c behavior. You could either have a monster generate with its
species-typical inventory by not specifying an inventory for it, or you
could have it generate with custom inventory but then have to use that
to clumsily reproduce the normal inventory's complex chances and
conditionals in mongets(). So the remainder of this commit implements
another flag for des.monster(), keep_default_invent, that allows for
more flexibility in two ways:

1. When des.monster() contains an inventory function and
   keep_default_invent is true, the monster will retain everything it
   gets from makemon() and the objects in the inventory function are in
   ADDITION to those. This is useful for augmenting a monster's default
   kit with something to make them more threatening, or just more loot.
2. When des.monster contains no inventory function and
   keep_default_invent is false, the monster will get NO inventory even
   if its species is normally supposed to. I'm not sure where exactly
   this would be used, but it doesn't hurt to have it available.

When keep_default_invent is not specified at all, the behavior remains
the same as it is now - if inventory is provided, default items are
discarded, and if not, they are kept.
2025-01-02 08:07:50 +02:00
copperwater
171d48c881 Fix: brides of Dracula not generating in their niches
When the des.monster() statements for the vampire ladies were changed to
use the lua-table form, the coordinate argument was not given the coord=
name in the table, so the lua loader was ignoring it and the vampire
ladies were placed on random spaces on the level. Fix this by supplying
the coord=; testing shows that they now appear back in the niches.

Also lowercase the monster species id "Vampire Lady" to "vampire lady".
The uppercase didn't affect the species being generated but having the
id be the same case as in monsters.h is consistent with how it's done
everywhere else.
2025-01-02 08:06:53 +02:00
copperwater
292957407f Fix: ravens specified as hostile on Medusa's Island could be peaceful
Noticed when testing the recent bec de corbin change which makes ravens
generate as peaceful; if you happened to enter medusa-3 while wielding
one, all the ravens are peaceful. Even without one, if you entered the
level as a neutral character, some of them would randomly be peaceful
due to matching alignment. But in the medusa-3.lua file, the ravens are
all unconditionally flagged as hostile.

The reason for this behavior is that the lua loading code does not
recognize "hostile" (instead peaceful=0 needs to be set), so it does
nothing and leaves the ravens to generate as if it had been unspecified.
It appeared to affect only these ravens; no other des.monster() uses
hostile=1 instead of peaceful=0.

This bug has been around in the 3.7 development branch since the change
to Lua, but doesn't happen in 3.6 because the des parser does interpret
"hostile" as meaning never peaceful.

I considered augmenting lspo_monster so that it could handle "hostile"
and treat it like peaceful=0, but figure it's probably better not to
have two different booleans that control the same flag (what if someone
specified peaceful = 1 and hostile = 1?)
2025-01-02 08:05:31 +02:00
copperwater
41d95d4325 Fix some bigroom wall corners to how they display in-game
Noticed a few corners in some bigroom maps were | instead of -, which
doesn't have any gameplay effect but was mildly annoying for what I was
doing at the time (copying the maps out into documentation that is
supposed to show what the maps look like in-game).

There are other special levels out there that still use | for corners;
this doesn't address those, only the bigrooms.
2025-01-02 08:03:21 +02:00
Pasi Kallinen
114f99867e Fix unicorn movement special handling
My commit 82f0b1e8ea to make monsters which had nowhere
to move would panic attack the hero if possible, broke the
special unicorn handling; they avoid being in-line with hero,
so often had nowhere to move...

Fixes #1344
2025-01-01 23:43:15 +02:00
Pasi Kallinen
0a58b7a540 Tweak tourist xp gain from new monsters
Remove the XP gain for tourist seeing a new type of monster
nearby, as it apparently made tourists a bit harder by forcing
early level gains.

Monsters next to hero are still marked as seen close-up, but
fix the code so it doesn't count undetected monsters.

Tourists still gain XP from "taking photos" of new types of monsters,
but only if they haven't seen the monster close up before.
(No actual photos are taken.)
2025-01-01 21:43:31 +02:00
nhmall
35f2ca44e2 update year in COPYRIGHT_BANNER_A to 2025 2025-01-01 08:46:41 -05:00
PatR
fea3c85471 fix issue #1350 - shop purchasing
Aka issue #1339 take II

For hero-owned container with some unpaid items, the itemized
shopping bill had a spurious index into the traditional shopping
bill (since it wasn't in that bill due not being unpaid).  When mixed
with unpaid items that weren't in the container, that could cause
bill corruption while updating the traditional bill during payment,
leading to impossible warnings.

Fixes #1339
Fixes #1350
2024-12-31 18:54:27 -08:00
keni
d329a4ce8a update tamc.nh docs (mnh.7) 2024-12-31 17:15:11 -05:00
G. Branden Robinson
a6a32170ee doc/dlb.6: Revise description
Content:
* Document that the command has a default file list.
* Demote "COMMANDS" section to "Operations" subsection.  The former term
  is (1) too easily confused with Unix commands and (2) not a widely
  used section heading in man pages.

Style:
* Italicize command names.
* Italicize file names.
* Use idiomatic man page cross references.
* Present operation and option letters in alphabetical order.
* Render option descriptions as full sentences.
* Set bug list as a bulleted list.

Markup:
* Break input lines at sentence boundaries.
* Favor use of man(7) font selection and alternation macros over roff(7)
  font selection escape sequences.
* Drop numerous extraneous paragraphing macro calls.  See subsection
  "Horizontal and vertical spacing" of groff_man(7).
* Replace use of *roff requests to break lines and vertically space with
  calls of paragraphing macros, which is what they're for.  Two things
  the page author didn't know: `.sp 1` already implies a break, so the
  preceding `.br` was redundant.  `.sp 1` without an argument already
  means to vertically space by 1 vee; that is, the "1" argument was
  superfluous.  It was a bad idea anyway because the default
  inter-paragraph spacing in man(7) is not one vee, but 0.4v--this
  matters when typesetting.  It has also been the case since 1979.
* Use `RS` and `RE` macros instead of a literal tab to achieve a
  relative inset.  Use of the macros is more idiomatic.
* Use `EX` and `EE` to attempt to set the examples in a monospaced font
  family.  These are extensions and are silently ignored by formatters
  that don't support them.

  groff_man(7):
     .EX
     .EE    Begin and end example.  After .EX, filling is disabled and a
            constant‐width (monospaced) font is selected.  Calling .EE
            enables filling and restores the previous font.

            .EX and .EE are extensions introduced in Ninth Edition Unix.
            Documenter’s Workbench, Heirloom Doctools, and Plan 9
            troffs, and mandoc (since 1.12.2) also support them.
            Solaris troff does not.  See subsection “Use of extensions”
            in groff_man_style(7).
* Kill off useless trailing space on input line.
2024-12-31 06:52:27 -06:00
G. Branden Robinson
0dc5d8c2f1 doc/dlb.6: Revise synopsis
Follow Unix idioms and the guidelines presented in groff_man_style(7).[1]

* Present multiple synopses since the command has multiple operation
  modes accessed via mutually inexpressible command letters.  See the
  POSIX standard for copious precedent.
* Stop implying that file name arguments are accepted alongside the `I`
  option; see line 236 of util/dlb_main.c.
* Stop spacing around synopsis punctuation where unnecessary.
* Set metasyntactic variables (parameters) in italics, not roman or
  bold.
* Spell ellipsis idiomatically for pleasant typesetting.
* Use `\c` escape sequence to force adjacency of tar-like option letters
  to the mandatory operation letter.
* Use singular, not plural, for repeatable argument.  The ellipsis does
  the grammatical work of pluralization for us.

[1] Full disclosure: I wrote much of (the current form of) that man page.
2024-12-31 06:52:27 -06:00