Commit Graph

14406 Commits

Author SHA1 Message Date
Ray Chason
5eaa162c82 Define and use PRINTF_F_PTR
GCCs older than 3.1 understand __attribute__(printf(...)), but only
with functions; it doesn't work with function pointers. This change
uses PRINTF_F_PTR to remove the attribute from two function pointers.

This change establishes GCC 3.0 as the minimum version to build
NetHack. Older versions have trouble with the variadic macros and
variable declarations in mid-block.
2022-11-03 19:33:30 -04:00
PatR
f6b3b968e7 change #vanquished from wizard mode to normal play
Make the existing '#vanquished' command be available during regular
play, with M-V bound to it.  'm #vanquished' or 'm M-V' brings up
the sorting menu that you get when answering 'a' rather than 'y' at
the end-of-game "disclose vanquished creatures?" prompt.

The original #vanquished came from slash'em, where it was available
in normal play.  When added to nethack, it was put in as wizard-mode-
only. I added the sorting capability several years ago.

The chosen sort is remembered and re-used if not reset but only for
the remainder of the current session.  It probably ought of become
a run-time option so be settable in advance and across sessions but
I haven't done that.
2022-11-03 00:00:34 -07:00
PatR
5ac048c8a6 'bad negation' during config file processing
This fixes the problem with reporting "the <foo> option may not
both have a value and be negated" to stdout if delivered before the
interface has been set up, so possibly not be seen.  It has been
using pline_The() but that uses rawprint() during startup.

Unfortunately testing it has uncovered another config file error
reporting issue and this one won't be so easy to fix.  For a logical
line that uses backslash+newline continuations to span multiple
physical lines, when there is a problem it reports the line number
and text of the last segment rather than of the first or of the
specific segment containing the problem.  That isn't necessarily
wrong but is suboptimal.
2022-11-02 15:56:10 -07:00
PatR
dd36d765b6 revise Guidebook.mn comment 2022-11-02 14:29:35 -07:00
PatR
8b466b227a fixes entry for PR #917 - unnaming unique mons
Pull request from entrez:  attempting to unname a unique monster or
shopkeeper by assigning a new name of <space> was rejected as
intended, but the rejection message is phrased strangely when <space>
gets inserted as the name that won't be assigned.

Fixes #917
2022-11-01 16:26:29 -07:00
Michael Meyer
eebe30b037 Message for giving unnameable monster blank name
The message for trying to (re)name an unnameable monster was weird when
the player entered a blank name (a name consisting of only spaces), in
an attempt to delete the monster's existing name rather than give it a
new one.  Several of the normal messages looked incomplete due to using
the blank string as the "new name" (e.g., "I'm Feyfer, not ."), and the
one which didn't include the name still seemed a little off ("calling
names" is almost the opposite of what the player is doing).  Add a new
message for attempting to erase the name of one of the special
unnameable monsters, e.g. "Juiblex would rather keep his existing name"
or "The Oracle would rather keep her existing title".

I also noticed that the message for trying to give an unrenameable
monster the name it already has (e.g. trying to name Death "Death") was
revealing the genders of the Riders with personal pronouns.  This is
avoided elsewhere (e.g. using "the way" in mdisplacem, "its" baked
into the message in mhitm_ad_deth), so I also added a slightly rephrased
alternate message for Riders which avoids any pronouns.  For the
unnaming message, on the other hand, I just used "its" for the Riders,
since I couldn't think of a way to phrase it that avoided pronouns
entirely.
2022-11-01 16:21:47 -07:00
nhmall
39b9669725 transcription error 2022-11-01 12:58:09 -04:00
nhmall
b4080cefcb more unnecessary #undef 2022-11-01 12:52:22 -04:00
nhmall
5192191e5d Qt: remove obsolete #undef lines 2022-11-01 12:46:10 -04:00
PatR
52511cd329 comment thinko 2022-11-01 09:29:19 -07:00
PatR
55ec68ef0a Longbow of Diana
Give an extra +1 to potential multi-shot to rangers wielding the
Longbow of Diana and shooting any type of arrow.  When an elf ranger
has been wielding an elven bow to shoot elvish arrows or an orc
ranger has been wielding an orcish bow to shoot orcish arrows, they
lose their racial bonus but won't lose any multi-shot capability by
switching to their quest artifact.  Human and gnome rangers gain the
+1 bonus.  (I have no idea how a gnome could wield a longbow.  One
would need a step ladder to hold it vertically, and could only draw
the string back a stubby arm's length if they held if horizonally.)

That bonus gets applied before feeding the multi-shot counter to
rnd() so doesn't mean an extra arrow every time.  And you have to
be wielding your own quest artifact--in addition to it being the
appropriate launcher for the ammo you're shooting--so doesn't provide
any multi-shot benefit to other types of characters who wish for it.
2022-10-31 23:13:05 -07:00
PatR
f3579ef4a5 refine all_options_conds()
Change the details of all_options_conds() which was added yesterday.
Creates the same output as then for #saveoptions.
2022-10-31 17:24:06 -07:00
PatR
1572877429 build fix for NODUMPENUMS and more issue #916
I made more things in dump_enums() static and/or const.  In the
process I discovered both compile problems for NODUMPENUMS and when
fixed, link problems for NODUMPENUMS+ENHANCED_SYMBOLS.

The uft8map.c portion has no changes, just reformatting.
2022-10-31 15:43:14 -07:00
nhmall
068b8fde71 Merge branch 'fix-makedefs' of https://github.com/argrath/NetHack into NetHack-3.7 2022-10-31 14:20:10 -04:00
nhmall
694fea1076 omdump declaration
..\src\allmain.c(1061): warning C4221: nonstandard extension used: 'ed': cannot be initialized using address of automatic variable 'omdump'
..\src\allmain.c(1056): note: see declaration of 'omdump'

Resolves #916
2022-10-31 13:29:08 -04:00
PatR
220726f7ba status condition options
Option parsing rejected
|OPTIONS=!cond_X
for all valid X.

Using the menu to unselect all condition options treated that as not
having made any choice and didn't make any changes.  That would be
reasonable if nothing was preselected, but things are so unselecting
all of them is a choice.  (A bizarre one, but still should be viable.)

Mostly this deals with including cond_X options when #saveoptions is
used to write a new RC file.  It now produces something like
|OPTIONS=!cond_barehanded,cond_blind,!cond_busy,cond_conf,!cond_deaf,\
|        cond_iron,cond_fly,cond_foodPois,!cond_glowhands,cond_grab,\
|        cond_hallucinat,!cond_held,!cond_ice,cond_lava,cond_levitate,\
|        !cond_paralyzed,cond_ride,!cond_sleep,cond_slime,!cond_slip,\
|        cond_stone,cond_strngl,cond_stun,!cond_submerged,cond_termIll,\
|        !cond_tethered,!cond_trap,!cond_unconscious,!cond_woundedlegs,\
|        !cond_holding
after the last alphabetical option and before the bound keys, menu
colors, and others which aren't simple OPTIONS=X settings.  This only
happens if there is already one or more OPTIONS=cond_X entries in the
old file when it was read or if 'mO' gets used to make any changes.

Not fixed:  after my RC had something similar to the above and before
I changed status conditions to accept negation, I was getting several
"the cond_ option may not both have a value and be negated" messages
written to stdout instead of the config file error handler.  So they
vanished when the screen was initialized without providing a --More--
prompt to acknowledge that they have been seen.
2022-10-31 00:53:10 -07:00
SHIRAKATA Kentaro
79927d70a0 remove the code for embedding SCCS ID
This code is for UNIXy build, but current UNIXy builds define GCC_WARN,
so this is never used.

(After all, embedding SCCS ID itself is out of date.)
2022-10-31 15:57:28 +09:00
nhmall
ad23b4e8e1 grammar: "foo based" to "foo-based"
There seems to be a need to locate these in the distribution every decade or so.
2022-10-30 16:08:14 -04:00
PatR
333735863f tweak for #914 - attacking nothing
In the code that checks for attacking the edge of the map, the m_at()
that was just introduced isn't at risk of using <0,0> because of the
way 'glyph' is initialized.  But guard against future changes.

And I omitted this when checking the PR #914 commit in:
Closes #914
2022-10-29 23:48:46 -07:00
PatR
7c8afb3228 pull request #914 - attacks against 'thin air'
Pull request from entrez:  hand-to-hand attack directed at an unseen
displacer beast could give strange feedback if it and hero swapped
places.
2022-10-29 15:16:09 -07:00
Michael Meyer
671f68fe98 Some displacer beast swapping tweaks
When fighting an unseen displacer beast mapped as an 'I' glyph on the
map, its typical ability to swap places with you was disabled and
replaced by it being treated like "thin air".  This was because
execution reaches domove_fight_empty when the target swaps places with
you.  Other than the displacement passive, this function is typically
only reached if there's no monster on the target square, so it prints
the "thin air" message and wastes a turn if you'd "expect" to attack
something (either because the player used an 'F' prefix, or because
there is an 'I' mapped on the destination square being moved into).

Hitting "thin air" seems like OK behavior for force-fighting a displacer
beast, since you are explicitly not trying to move into its spot (though
you could probably make an argument that the displacement should happen
even then, since it's the displacer beast initiating it), but the mon
being mapped as an 'I' doesn't seem like a good reason to disallow the
actual displacement from happening.

Don't treat an 'I' as "thin air" in domove_fight_empty if there's
actually a monster there, since it means there's a displacer beast
trying to swap places with you.

A couple other related changes: put an 'I' down on the map when an
unseen displacer beast swaps places with you, and use 'something' in the
'it swaps places with you' message when you didn't even realize there
was a monster there to begin with, so there's no context for the 'it' (I
used Some_Monnam at first, but the 'something' felt a little weird when
you were intentionally attacking an 'I' or warning glyph; this limits
the usage of 'something' further than Some_Monnam does).
2022-10-29 15:15:07 -07:00
nhmall
99a93fe50b some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.

If you want to try building on a platform that doesn't offer those
two functions, these are available:
    define NOT_C99       /* to make some non-C99 code available */
    define NEED_INDEX    /* to define a macro for index()  */
    define NEED_RINDX    /* to define a macro for rindex() */
2022-10-29 10:54:25 -04:00
nhmall
943c1bc3c3 more OSX -> macOS 2022-10-29 10:46:14 -04:00
nhmall
1adfbd2594 fixes update for pr913 part 2 2022-10-29 10:43:58 -04:00
nhmall
b445b99214 fixes entry for pr913 2022-10-29 10:38:29 -04:00
nhmall
91ce86326b Merge branch 'qt6-buttons' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-29 10:33:37 -04:00
nhmall
a51c983a13 Revert "PR913 - Another Qt 6 signal: mapped -> mappedString"
This reverts commit 57617da39b.
2022-10-29 10:33:17 -04:00
PatR
ad74d9e407 fix RC file CHOOSE '[section] #comment'
Two years ago I modified the parsing for [section] labels for the
config file's CHOOSE directive to allow end-of-line comments, but
the code used had a logic error (don't think I can blame it on
copy+paste).  It looked for '#' after ']' but allowed anything--
rather than just spaces--in between.

"[section-name]abc#comment" would become "section-name" as if the
trailing junk hadn't been present.  Parsing that should produce
"section-name]abc" and get rejected as invalid.
2022-10-28 23:26:39 -07:00
PatR
8034a0d60e w_blocks()
Add the fix that silences whatever extra warning was enabled for the
onefile testing.  The original already worked as intended.
2022-10-28 16:27:41 -07:00
PatR
cec7da0505 another comment typo fix 2022-10-28 00:30:38 -07:00
PatR
d2fe949ab9 yet more knockback induced dismount
The revision to directed dismount during knockback introduced a bug.
Need parentheses to prevent || that follows ?: from binding with :.
2022-10-28 00:27:32 -07:00
Ray Chason
57617da39b PR913 - Another Qt 6 signal: mapped -> mappedString 2022-10-27 22:59:30 -04:00
Ray Chason
defecc5110 Another Qt 6 signal: mapped -> mappedString 2022-10-27 22:50:17 -04:00
nhmall
2fef1f497c more Guidebook updates 2022-10-27 22:27:00 -04:00
nhmall
ee03f5c2ba Merge branch 'showgold-guidebook-update' of https://github.com/entrez/NetHack into NetHack-3.7 2022-10-27 22:23:34 -04:00
nhmall
95adc9d661 Merge branch 'pr913' into NetHack-3.7 2022-10-27 22:15:00 -04:00
nhmall
1c0261a397 Merge branch 'qt6-buttons' of https://github.com/chasonr/NetHack into pr913 2022-10-27 22:14:13 -04:00
Ray Chason
5c001d3a32 Use idPressed signal for Qt 6 2022-10-27 21:51:10 -04:00
PatR
e121eee867 end-of-game disclosure for gold in invent on tty
Reported by entrez:  disclosing inventory at end of game did not show
gold.  Not mentioned:  only for tty.

It was using the same window as gets used for perm_invent (although
not shown _as_ perm_invent because end of game turns that off) and the
default for whether to show gold is different for tty than for other
interfaces due use of experimental TTYINV from player's environment.

Force the end of game inventory disclosure to work the same as the
dumplog inventory listing and use a different window, by falsely
telling display_inventory() that a response is requested.  Works but
the whole inventory mechanism has become quite convoluted.
2022-10-27 17:25:14 -07:00
PatR
9682f84aed more knockback induced dismount
When looking at the previous commit, I realized that my comment about
radius 1 was wrong.  The original code prefers dismounting to spots
that are orthogonal to the steed's position over diagonal ones.  It
doesn't say why.
2022-10-27 15:55:57 -07:00
PatR
da32b572a6 knockback knocking riding hero out of saddle
I've implemented targetted dismount such that being knocked out of
the saddle will place the hero opposite the attacker in preference
to a random spot adjacent to the steed.  If that opposite spot
isn't appropriate, the two spots next to it get tried.

In these map fragments, H is knocking mounted hero off of u.  The
digits indicate priority of potential destinations.

|.....   |..21.
|...2.   |..u2.
|.Hu1.   |.H...
|...2.   |.....

If spot 1 isn't acceptable, both of spots 2 (in random order) will
be tried next.  If those aren't acceptable either, it will try the
other 5 spots adjacent to the steed (the one of those with the
attacker will always be unacceptable).  And as before, it none of
those work, it uses enexto() to pick a random spot as close to the
steed as feasible.

Not knockback:  when dismounting due to polymorph, avoid diagonal
adjacent spots if hero's new form can't move diagonally.  (The hero
can't already be in no-diagonal form because riding requires that
the rider be humanoid.  I keep thinking the restriction is "can't
be polymorphed" but that isn't correct.)
2022-10-27 15:33:49 -07:00
PatR
69f62e5872 fix comment typo 2022-10-27 14:52:50 -07:00
Michael Meyer
f39a158bdd Update Guidebook #showgold info
The #showgold command now does mention known contained gold in your
inventory, so the various lines in the Guidebook which explicitly state
that it doesn't needed to be updated.  Wish I had noticed this in time
to put it into the previous Guidebook patch I submitted, but what can
you do.
2022-10-27 16:21:11 -04:00
nhmall
8b89917ede be consistent for all patforms in fixes3-7-0.txt 2022-10-27 15:49:16 -04:00
nhmall
3cd99786f2 doc/Guidebook.txt update 2022-10-27 11:33:10 -04:00
nhmall
c2df67b1f1 Guidebook date stamp 2022-10-27 10:47:03 -04:00
Michael Meyer
19a02b7e18 Guidebook updates 2022-10-27 10:40:54 -04:00
nhmall
b70a3d198e add a fixes entry for pull request #910 2022-10-27 10:07:32 -04:00
nhmall
bddaf28ea6 Merge branch 'unicode-Qt' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-27 10:05:04 -04:00
nhmall
8c9d4de9ed Merge branch 'no-urace-in-is_foo' of https://github.com/entrez/NetHack into NetHack-3.7 2022-10-27 10:04:11 -04:00