Various places checking for whether a monster was on the map based on
mstate flags were inconsistent about which ones they checked (and then
place_monster() was additionally inconsistent with all of them about
which bits were cleared when placing a monster onto the map). I think
some places were also more convoluted than is now necessary because they
date back to mstate being an alias for mspare1, which it shared with
migflags before those became two separate dedicated fields (MSTATE_MASK
also dates back to this and is no longer used, so I removed it).
I tried to go through all the MON_foo mstate bits, understand when/why
they are set, and make the various functions I noticed more consistent
(with each other, and with my understanding of how the bits work) about
how they are treated. I don't know for a fact that I understood
everything right -- some diagnostic bits that aren't used for much of
anything, like MON_OBLITERATE, had me mystified until I read the 5ee78c5
commit message -- but this patch hasn't caused any new problems (sanity
check or otherwise) with the fuzzer in my testing so far. All the same,
it could probably use review by someone who has a good sense of what the
mstate bits mean.
Put everything through a single function that can handle all the
complicated parts of using the correct proposition for different terrain
types, and will not just call things "solid ground" indiscriminately.
This got complicated but I'm not sure if it's possible to do it much
simpler while still using the distinct names for each type of terrain
(unless you are OK with the sentences sounding sort of wonky).
When moving off a body of water with mention_decor on, describe_decor()
would produce messages like "You are back on cloud", "You are back on
wall", and "You are back on air bubble." For those types of terrain
that were producing odd sentences like this, change the format to "You
are back in a cloud", "You are back in a wall", "You are back in an air
bubble", and "You are back in the air."
With mention_decor enabled, exiting the water on the Plane of Water
would produce the series of messages "You pop into an air bubble. You
are back on air bubble." Suppress the second message. The lack of
article there seems like a problem too...
Also, acknowledge flight/levitation and use ice_descr in the pooleffects
"solid land" message. This should make it more consistent with how
mention_decor does a similar message, especially changes to how it
describes ice based on its melt timer.
Turns out this change to more accurately describe the wall of water in a
situation that shouldn't come up in-game messed up some uses of
dfeature_at which do a string comparison between the result and "pool of
water" to determine how to behave.
Pull request from entrez: sysconf's EXPLORES=user-list is checked by
the #exploremode command but was no checked by -X on the command line
or 'playmode=explore' in the RC file. Also a save file from wizard mode
that wasn't allowed to be restored in wizard mode (different user or
change in sysconf's WIZARDS=user-list) would 'downgrad' to explore mode
with checking whether the current user is allowed to use that.
Closes#1110
I realized that failed explore-mode authorization on a special-mode
saved game cannot downgrade the game mode further down to a normal game,
because this would dump the player back into a state where she has
completed some part of the game in explore mode but is eligible for the
topten list. This is even more true when the game was formerly a
wizard-mode game. Unforunately, that was the state my previous commits
left the game in.
Instead, if restoring an explore-mode or wizard-mode savegame, and the
player is authorized via sysconf for neither of those modes, fail
restoration entirely and start a new game instead. That's sort of
clunky and there could probably be more explanation provided, but it
should be an exceedingly rare occurance and I'm not sure what
alternative exists that would still honor the EXPLORERS and WIZARDS
restrictions. This shouldn't affect the way they default 'down a mode'
in other circumstances, i.e. the overwhelming majority of situations in
which EXPLORERS authorization is needed/checked.
For the same reason, I realized that the player can't be prompted
whether or not to enter explore mode, if being downgraded from a
no-longer-authorized wizmode save while explore mode is authorized. The
change from wizard mode to explore mode must be mandatory. I have also
switched that up so that it will force the change -- unfortunately, this
has the side effect of allowing the preservation of the save, but it's
more important to make sure a wizard mode game doesn't get reverted to
normal mode. They won't be able to load the save into wizard mode
anyway.
If an unauthorized player requests the game launch in wizard mode, it
will try to put her in explore mode instead. If this happened during
restoration of a previous (normal) saved game, the setting of discover
in wd_message() would bypass iflags.deferred_X, allowing the player to
select to keep the non-explore-mode save file. [Actually, when I tested
it I always got an error when answering yes to the "keep the save file?"
prompt, but that's a problem too...] Because deferred_X was still 1
after this, the pline "You are already in explore mode" would also be
printed following the prompt (when moveloop_preamble() attempted to set
explore mode).
Fix this so that loading a normal game with -D, then failing the
authorization, boots into explore mode via iflags.deferred_X and the
"really enter explore mode?" prompt, as it would have if -X were
specified on the command line to begin with.
The sysconf EXPLORERS list restricting access to explore mode was being
evaluated and used when a player used the #exploremode command in-game,
or when specifying -X or OPTIONS=playmode:explore on the command line
when resuming a normal game, but not when starting an entirely new game.
When SYSCF is avilable, check for authorization early, similar to debug
mode authorization, to restrict access to explore mode to EXPLORERS
under (hopefully) all circumstances.
Now that CHECK_PLNAME is a sysconf option, it can be possible to
authorize wizard mode even if get_unix_pw() fails to return the user's
login name, so I think the call to check_user_string() should go out
either way in case that's what's happening.
One can observe the following problems when generating or viewing plain
text versions of the Guidebook. (There are three; "Guidebook" and
"Guidebook.txt" are identical, and are paginated; "Guidebook.dat" is not
paginated.)
1. The line "(Edited and expanded for NetHack 3.7.0 by Mike Stephenson
and others)" is overset.
2. So are Figures 1 and 2, by one character cell, when rendered with
groff 1.23.0 because of the way it handles boxed tables and those
with vertical rules at table boundaries.
https://git.savannah.gnu.org/cgit/groff.git/commit/?id=8f066786ea3cb5e1dbade1149e7d50ae978da202
3. When viewing the Guidebook in an 80-column terminal, the left and
right margins are asymmetric; you get 10 columns on the left but
only 5 on the right.
So:
* doc/Guidebook.mn: In nroff mode, set page offset to 5n and increase
line and title line lengths by 5n to 70n.
Now, the margins are symmetric, there's ample room for the figures, and
the expansion credit fits.
(One diagnostic remains when formatting with groff 1.23.0.
troff:tmac.n:762: error: cannot load font 'S' for emboldening
This is a groff bug and will be fixed in the next release. The
diagnostic is spurious and can be ignored.
See <https://savannah.gnu.org/bugs/?64866>.)
Explain behavior of GNU tbl when setting boxed tables on terminals.
Drop reference to bug fixed in groff 1.23.0
<https://savannah.gnu.org/bugs/?49390>.
There's not much to say about other tbls except that they handle boxed
tables _terribly_ on terminals.
$ cat ./hello-table.roff
.TS
box;
L.
hello
.TE
$ ./bin/tbl ./hello-table.roff|./bin/nroff|cat -s # Heirloom Doctools
_______
hello
_______
|
| |
DWB tbl behaves the same way. I expect all System V Unix-descended
tbls/nroffs do the same.
This is my attempt to revise the figure by working _with_ tbl(1)
and nroff(1)/troff(1) features instead of fighting them or enduring
suffering and significant maintenance challenges.
* Stop using mn(7) display macros; the other two figures didn't and they
don't appear to be buying much.
* Use `tr` character translation feature to temporarily remap characters
for clarity of input. It's convenient to input ordinary characters
here since the table's contents are (mostly) character-cell art.
Remap `-` to minus sign and `@` to the "reverse solidus" special
character. (`\` is the default *roff escape character. It can be
changed, but attempting that seems hopeless inside a tbl(1) table.)
Revert the translations after the table. (There's nothing special
about `@`; you could choose any other character that isn't otherwise
needed in the table.)
* Use `box` region option as with Figures 1 and 2. Perhaps this wasn't
done because those are meant to depict a terminal window, but Figure 2
depicts only part of one, so its top border is a fib.
* Use `expand` region option to obtain roughly the same spread-out
effect that the table was laboriously using empty columns and the `e`
column modifier for.
* Consequently, reduce the column count to 2; both have real content.
* Annotate both keycap diagrams--in part for clarity, but also to make
it more obvious that the columns will balance in width.
These changes don't require GNU extensions to *roff or tbl except,
arguably, the \(rs special character. But support for that special
character identifier is easily added to any device-independent troff;
see §23.2 of CSTR #54 (Kernighan 1992 revision) or groff_font(5). Or I
can prepare a patch--just ask me. But given that no one seems to have
complained about the disaster that AT&T tbl/nroff must have been making
of Figures 1 and 2 for decades, I'm guessing this isn't a practical
concern. Any if it _is_ a problem, `\e` can be used instead of `\(rs`.
(I didn't use it because what is wanted is the backslash glyph
specifically [to mirror `/`], not "the escape character". But given the
constraints imposed by use of tbl(1), it's an academic point.)
On my system, the figure captions in Guidebook.ps were getting set in
Courier roman. This was clearly unintentional. Here's why it didn't
work.
1. Figures 1 and 2 selected the previous font, but only after a table
had been set. But tbl(1) does not preserve identity of the previous
font. I investigated, and none of GNU, Heirloom Doctools, nor
Documenter's Workbench tbl implementations preserve it. So the user
can't rely on it. See
<https://savannah.gnu.org/bugs/index.php?64862>.
2. Figure 3 attempted to select the roman font (typically Times), but
did so in a table cell that was empty of text. It therefore did not
have any visible effect.
* doc/Guidebook.mn: Explicitly select font `R` after setting tables. On
typesetters, put half a vee of space between the table's box border
and the figure caption.
doc/Gbk-1pg-sfx.mn is already using one half of a sound technique: set
the page length to a very large value, guaranteed to overshoot the
vertical space required by the document's text. The other half is to,
at the end of the document, set the page length to the current vertical
position, so that it ends immediately.
https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Spacing.html
String definitions were being used with a pointless leading double
quote. This syntax is used only to define strings containing leading
space characters. (You might also use it defensively if you're defining
one string whose contents start with the interpolation of another, and
the latter might interpolate leading space--but that is not the case
here.)
Remove unnecessary leading quotes from string definitions.
* doc/Guidebook.mn: Do it. Also annotate empty strings with comment.
* sys/unix/hints/include/gbdates-post.370: Don't put them back.
https://www.gnu.org/software/groff/manual/groff.html.node/Strings.html
Reported by entrez, some putstr() to text window got changed to
add_menu_str(). I didn't test with curses; with tty some headers
ended up in limbo: "Artifacts" header for '` a y' (wizard mode show
artifacts, something I had forgotten even existed) and also monster
class headers for 'm #vanquished by-class' (available to everyone).
Qt lost them too, but at least it didn't panic.
Not due to over-simplification: end of game disclosure suppresses
header line highlighting, except when disclosing final inventory.
Change it to do so, although it would be simpler overall to just not
bother with any menu_headings highlight suppression.
Pull request by entrez: refine the recent change to have buried
zombies be affected (emerge from ground sooner) by objects that
impact the ground on or near their burial spot.
Closes#1119
Change 852f8e4 by requiring a minimum impact before a buried zombie
nearby will be disturbed: light, but still excluding things like
scrolls, if it's a violent impact (dropped while levitating, thrown, or
kicked), and fairly heavy if the hero is just placing the item on the
ground normally.
Moving the call out of flooreffects meant it no longer applied to
pushing boulders around, so have moverock disturb nearby zombies. I
additionally had wake_nearby do the same thing.
Finally, I renamed check_buried_zombies (which doesn't really reflect
what it does) to disturb_buried_zombies.
My compiler didn't warn about this. The value conditionally gets set
but then isn't used anywhere besides that. For the time being, give
'skipped_noninuse' a fake use rather than eliminate it altogether.
'nethack --show' is rejected, which is ok, but the feedback is
'prscore: bad arguments (2)' which is pretty confusing.
Reject any --s unless it's the start of --scores or --showpath[s].
'nethack --show' will be rejected as "Unknown option: --show."
'nethack -show' is still accepted and will report that it can't find
any scores for how as it always has (assuming that there aren't any
score entries for "how" :-).
dosacrifice() into a separate routine.
Pull request from argrath: move the code that handles same-race
sacrifice into a separate routine.
Log message for commit d5fa2f8ba0.
Closes#1120
Pull request from entrez: clean up the if/else-if/else logic in
level_tele().
Trying things a little differently this time. This is an extra log
message for commit 4876b70b9b.
Closes#1115
Remainder of 'database-suggestions' pull request by entrez: named
fruit lookup when checking for data.base entries.
I'll admit that not sure what this actually accomplishes and am not
interested enough to figure it out myself.
This is the first time I've ever managed to do something useful with
'git cherry-pick', although I haven't tried much after early failures.
The other part of the pull request was dealt with manually earlier,
commit bc9518ca16.
Closes#1109
Use fruit_from_name instead of checking gp.pl_fruit directly so that
changing the fruitname won't cause fruits already in the player's
inventory to stop working with lookup.
Add a new option 'perminv_mode' to augment perm_invent. It handles
the same choices as the temporary TTYINV method: show all items other
than gold, show full inventory including gold, or only show in-use
items (similar to the '*' command).
For tty, both the all-except-gold and full-inventory modes can add
the poorly named 'sparse' variation which populates unused slots in
its fixed grid with the inventory letter that would go in each.
For others, the default has been changed from full-inventory to
all-except-gold. Note that gold is treated as part of 'all' or of
'in-use' if it is quivered because having the amount be shown on the
status line doesn't make that redundant.
Changing the default may mess up WinGUI if it assumes that perm_invent
is full inventory with gold.
Initially I was going to change perm_invent into a compound but this
leaves it as an on/off toggle and adds perminv_mode as a separate
option for how to show the inventory when the toggle is on. It may
make sense to combine them since dual controls is a little confusing,
but right now setting perm_invent On when perminv_mode is 'none'
changes that to 'all' and changing perminv_mode away from 'none' when
perm_invent is Off toggles it to On.
Guidebook.mn has been updated but as usual Guidebook.tex is lagging.
If there's room, avoid writing the column indicator (when one or more
entries have been truncated due to insufficient window width) on an
entry. Only applies to first page so only matters if sortpack is off.
Also, for windowborders=3 or 4, where the map, message, and status
windows have borders but the perm_invent one doesn't, insert a blank
line at the top when there is only one line of output (such as "not
carrying anything") so that it lines up with the top line inside the
adjacent window rather than with that window's top border. No effect
when perm_invent itself has a border or when none of the others do.
Part of the pull request by entrez, changing a few data.base entries
recently introduced by PR #1108.
Changes ice box to a different quote, but I've re-applied the prior
quote to ice terrain rather than delete it. Also replace a UTF
apropostophe in the ice quote which escaped the previous purge of
such things.
Replaces the C.S.Lewis quote for Demonbane with a one-liner from the
Bible. I realized a bit late that Demonbane is no longer a sword and
never given to lawful Angels as starting gear anymore, consequently
the new quote doesn't fit very well.
The PR changed the helm of brilliance entry to be for all helms and
this rejects that. Instead, it adds a few generic helmet descriptions
and changes the helm of brilliance quote--now misquote--to be useful
to players, describing it as crystal rather than steel.
Pull request 1109 is still open--there's a second commit in it dealing
with fruit name handling that this commit doesn't touch.