PatR [Thu, 22 Oct 2015 23:35:01 +0000 (16:35 -0700)]
formatting: src/m*.c - p*.c continuation lines
Somewhere along the line I started removing redundant parentheses from
return statements, but only in files that needed continuation fixups
so it's not comprehensive.
PatR [Tue, 20 Oct 2015 00:32:21 +0000 (17:32 -0700)]
formatting: src/a*.c - d*.c continuation lines
Mostly && and || at end of the first half of a continued line rather
than at the start of the second half. The automated reformat got
confused by comments in the midst of such lines.
foo ||
bar
was converted to
foo
|| bar
but
foo ||
/* comment */
bar
stayed as is.
Some excluded code [#if 0] was also manually reformatted, but this is
mainly stuff that can be found via regexp '[&|?:][ \t]*$' (with a lot
of false hits for labels whose colon ends their line).
PatR [Mon, 19 Oct 2015 00:37:15 +0000 (17:37 -0700)]
unsplitting split object stack
Replace the code that Dean objected to with something a little bit more
robust. It doesn't rely on the two stacks being adjacent or having the
same inventory letter. It is still vulnerable to having another
splitobj() occur between the offending split and its attempted unsplit,
or to either of the two halves of a split being extracted from their
object chain. As before, failure to unsplit only results in the two
halves of the split remaining separate stacks, not anything more drastic
like the panic() that prompted all this.
Simplification of hallucinated currency names got mixed in with this
patch. I haven't bothered separating it back out.
Whoever reset PATCHLEVEL to 0 jumped the gun. This patch increments it
since change to the 'context' structure breaks save file compatibility,
so it will need to undergo another reset before release.
PatR [Mon, 19 Oct 2015 00:29:19 +0000 (17:29 -0700)]
clear_bypasses() comment
While looking at clear_bypasses() I noticed some excluded code [#if 0]
which could be risky to include, so update the comment there. Also,
excluded code tends to need formatting fix-up.
PatR [Sun, 18 Oct 2015 00:00:53 +0000 (17:00 -0700)]
wet towel enhancements
Flesh out wet towels a bit:
1) wielding a wet towel--or a dry one which becomes wet--won't give a
"you begin bashing with your wet towel" message when attacking;
2) if a formerly wet towel dries out completely while wielded, *do* give
"you begin bashing with your towel" on the next attack;
3) successfully hitting with a wet towel no longer always loses wetness;
4) water damage to dry towel always confers at least 1 point of wetness;
5) taking fire damage (via burnarmor() which is used for most types of
fire damage) has a chance to partially or fully dry a wet towel
(regardless of whether it's wielded at the time; applies to monsters
as well as hero; each towel being carried is checked until one is
affected, then any others escape drying.
Not done:
-) attacking with a wielded wet towel perhaps ought to be treated as a
weapon attack using whip skill rather than an augmented arbitrary-
junk-by-weight attack;
-) throwing a wet towel should probably ignore wetness--it's just a wet
piece of cloth when not finishing with a whip snap; right now, it
loses a point of wetness when thrown and usually--#3 above--another
point if it hits...;
-) hitting burning creatures is no different than hitting anything else;
-) likewise for hitting wet creatures.
PatR [Wed, 14 Oct 2015 23:58:26 +0000 (16:58 -0700)]
'v' vs '%'
Guard against the possibility of BETA_INFO (or other fields used to
construct the one-line version string) having a percent sign that would
be misinterpreted during pline processing.
PatR [Tue, 13 Oct 2015 22:15:06 +0000 (15:15 -0700)]
sp_lev.c warnings
Fix a couple of warnings about prototype not matching function definition.
Prototype specified a narrow scalar ('boolean') but function uses old-style
definition which implicitly promotes narrow types (char,short,'boolean' to
int, float to double). Switch prototypes to BOOLEAN_P.
A whole bunch of prototypes specify STATIC_DCL ('static') and then leave
the definition without STATIC_OVL (also 'static'). I only fixed up a
couple of those, but we risk getting somebody using an old compiler that
doesn't like
static int foo();
int foo() { return 42; }
Even if every comiler accepts that (I don't recall whether that was kosher
in the ancient K&R days), you can't tell by looking at the function
defintion (in the usual case where the forward declarations are at the top
of the file rather than immediately before the defintiion) whether it's
local to that file or global, so the missing STATIC_OVL qualifiers ought
to be added.
PatR [Tue, 13 Oct 2015 21:33:42 +0000 (14:33 -0700)]
fix inappropriate merge during aborted throw
Fix the situation reported by Pasi where cancelling a throw via ESC at
the "which direction?" prompt resulted in "object null after merge"
panic from addinv(). I wasn't able to reproduce the panic, but I could
see the throw-nowhere stack getting merged into the quiver stack when
it shouldn't. This fixes that.
Also a couple of formatting bits. I wish I'd quit coming across those.
Pasi Kallinen [Tue, 13 Oct 2015 16:00:18 +0000 (19:00 +0300)]
Fix C343-341: Stuck in minetown room
Bustling Town can be generated with inaccessible areas outside the
top edge of the fixed town map. If you end up in one of those area
without any way to dig or teleport, you're stuck.
This adds a new level flag "inaccessibles" to force checking for
such inaccessible areas, and add secret doors, holes/trapdoors,
or some random escape item into the areas.
Pasi Kallinen [Tue, 13 Oct 2015 13:27:58 +0000 (16:27 +0300)]
Wet towels deal more damage
Dipping a towel into a potion, fountain, or some other water source
makes the towel wet. Hitting with a wet towel deals up to 6 points
of damage, but every hit reduces wetness, as does throwing or applying
the towel. You can also wish for a moist or wet towel.
Pasi Kallinen [Mon, 12 Oct 2015 09:00:47 +0000 (12:00 +0300)]
Fix the makemon random coord picking again
This time try random locations up to 50 times, then start going
through the map in order to find a good position. First round
tries to pick a location not in sight, if that fails, it might
try stair or ladder location. If that fails, then it will pick
any good position, whether in sight or not.
Outside field of vision restriction and trying stair or ladder
locations does not happen when the monster is placed from special
level code.
PatR [Mon, 12 Oct 2015 02:39:23 +0000 (19:39 -0700)]
wishing for novels
Make novels be wishable in normal and explore modes in addition to
wizard mode. I don't think this weakens the tribute and it prevents
someone who attempts such a wish from getting misleading feedback of
"Nothing fitting that description exists in the game."
Wishing for "novel" will yield "novel named Foo" where "Foo" is a
randomly chosen Discworld title. Wishing for "novel named Bar" will
yield "novel named Bar" or "novel named The Bar" if "Bar" or "The Bar"
is a valid Discworld title, or else override "Bar" and pick random
Discworld "novel named Foo" if it isn't.
Since first read of a novel bestows some experience (once per game, no
matter how many novels become available), a pacifist with an early
wish can get a head start. I don't think that's a big deal. And it
will require an awful lot of wishes for any player who wants to acquire
all 41 titles in one game. I imagine someone will manage it.
Pasi Kallinen [Sun, 11 Oct 2015 18:51:01 +0000 (21:51 +0300)]
Fix segfault when tripping over something
If you tripped over something, and there were no rocks on
that place, the otmp object variable was set to null but used
later for checking if it was a corpse.
Pasi Kallinen [Sun, 11 Oct 2015 15:52:24 +0000 (18:52 +0300)]
Put monsters into limbo if they cannot be placed
Whenever mnearto tries to displace a monster from underneath
another, and the displaced one cannot be placed anywhere,
make it drop special objects and put it into migration, with
the current level as the target.
This should be a good enough stopgap measure - it's not going
to happen unless the level is (nearly) full of monsters.
And it seems to cure a near-impossible-to-track data corruption,
with monster list pointing to garbage.
Pasi Kallinen [Fri, 9 Oct 2015 05:00:43 +0000 (08:00 +0300)]
Fix cursed scroll of light on the rogue level
Being blind and engulfed, reading cursed scroll of light did still darken
the room on the Rogue level. This also changes the logic a bit, so that
cursed scroll of light will douse lamps in your inventory, even when
swallowed.
PatR [Fri, 9 Oct 2015 01:05:05 +0000 (18:05 -0700)]
litroom() vs Blind
An item from the "A few bugs" mail was that reading a scroll of light
when swallowed didn't light the surrounding area--which is intended--
but that doing so while blind *did*. The logic in litroom()--which
the report was based on--was wrong, but do_clear_area() prevented the
light was escaping the engulfer. So there was no bug from the player's
perspective, but only because the vision code has special handling for
being swallowed. This fixes litroom()'s logic and does some formatting
cleanup.
PatR [Thu, 8 Oct 2015 09:19:58 +0000 (02:19 -0700)]
spell of protection
Another item from the "A few bugs" mail. Casting spell of protection
when previous casting(s) hadn't timed out yet miscalculated the new AC
boost. At low levels--when this spell probably gets its most use--the
bug wasn't noticeable. (At high levels when someone might cast it a
whole bunch of times in succession, the effect could be noticed but
was probably just assumed to be working as intended. Its behavior is
somewhat convoluted.)
PatR [Wed, 7 Oct 2015 23:32:10 +0000 (16:32 -0700)]
MUSE for branch stairs
Fix another item in the "A few bugs" mail. Monsters who wanted to flee
weren't able to use 'sstairs' (extra stairway leading to different branch
of dungeon) due to a logic error in the find_defensive() choices.
if (terrain==STAIR) {
} else if (terrain==LADDER) {
} else if (x==sstairs.sx && y==sstairs.sy) {
} else { /* check traps */
}
wouldn't find 'sstairs' because they have terrain type STAIRS. (Also,
the sstairs check wasn't screening out immobile monsters, but that bug
didn't have a chance to manifest.)
There's a bunch of reformatting, and some code re-organization to improve
other formatting, and some additional logic fixes.
Pasi Kallinen [Tue, 6 Oct 2015 15:47:52 +0000 (18:47 +0300)]
setmnotwielded should always MON_NOWEP
Instead of making the caller remember to use MON_NOWEP, make
setmnotwielded handle that automatically. This fixes the
"bad monster weapon restore" errors I've been seeing.
PatR [Tue, 6 Oct 2015 01:32:40 +0000 (18:32 -0700)]
flesh golem healing
Fix one of the entries in the "A few bugs" mail. Flesh golems hit by
electric damage calculated a healing amount of dam/6, then ignored it
and used dam instead. Probably never noticed in actual play....
PatR [Tue, 6 Oct 2015 01:18:03 +0000 (18:18 -0700)]
sanity check for embedded dragon scales
The problem discovered with sanity checking of embedded dragon scales
was with the checking, not with the object flagged "embedded in skin".
I thought W_ARM got cleared when switching 'uarm' object to 'uskin',
but it isn't.
His changes add file_exists() to sys/vms/vmsfiles.c, which might be
needed in the future but is not useful here. Checking for 'gbd' and
'grep' for PANICTRACE support (which I had working on Alpha--and
ought to work on VAX, no idea about IA64--before losing access to vms)
is pointless since neither is used.
src/files.c
SYSCF support, parse_config_line():
#if VMS, ignore GDBPATH and GREPPATH if present in sysconf;
SYSCF support, assure_syscf_file():
#if VMS, force open()'s optional third argument since the macro
which redirects open to vms_open requires it.
src/sp_lev.c
selection_do_randline():
use configuration-specified 'Rand()' rather than raw 'rand()'.
Pasi Kallinen [Sun, 30 Aug 2015 18:29:04 +0000 (21:29 +0300)]
Add new scroll names
via UnNetHack, with some slight changes:
1) Folded the two Portal references into one
2) Removed "ACHAT SHTAYIM SHALOSH" ("One Two Three" in Hebrew and apparently
Uri Geller's catchphrase) - I know nothing about Hebrew nor Geller, or
whether this would be appropriate to add.
3) Added "XOR OTA" ("Atorox", reference to Finnish fandom and early scifi)
PatR [Fri, 21 Aug 2015 01:31:12 +0000 (18:31 -0700)]
unicorn horn vs deafness
Implement the suggestion that applying a non-cursed unicorn horn can
cure deafness like other similar troubles. Also, applying a cursed one
can cause deafness, although I made the chance be half of what it is
for the other troubles since they tend to be more significant.
This is entry #2 on the bugzilla list, but I haven't figured out how to
update that yet.
PatR [Sat, 15 Aug 2015 02:18:12 +0000 (19:18 -0700)]
branch traversal via W quest artifact
Require the hero to pass the next_to_u() check when using the Eye of the
Aethiopica to portal to another dungeon branch. Even though the reported
exploit of having a steed which is carrying the Amulet bring it along had
already been prevented, this changes the temporary portal behavior to be
like level teleport. A steed carrying the Amulet or a non-adjacent pet
on a cursed leash will inhibit the attempted change of location.
Pasi Kallinen [Thu, 13 Aug 2015 12:53:24 +0000 (15:53 +0300)]
Add a chroot install hints file for linux
This makes installing NetHack on a public server much easier.
Required some minor changes to the unix top-level Makefile, and
the other hints files; Makefile variable HACKDIR may not be a
full path anymore, use INSTDIR instead.
PatR [Wed, 5 Aug 2015 00:41:54 +0000 (17:41 -0700)]
fix up Guidebook.mn's preface
Make the preface have an unnumbered header and force a new paragraph
for its text;
remove the unterminated switch to bold font;
change "Terry Pratchett" from bold to italics to match Guidebook.tex's
setting.
PatR [Tue, 4 Aug 2015 01:38:38 +0000 (18:38 -0700)]
wear/remove commands, P & R vs W & T
Allow 'P' and 'R' commands to accept armor and wear/take-off the chosen
item, and 'W' and 'T' commands to accept accessories and put-on/remove
the item. The which-object prompt only lists the type(s) of items that
traditionally go with each command, as does an inventory menu if the
user picks '?', but items of the alternate type(s) can be chosen, by
unshown letter or by the inventory menu given for '*'.
There shouldn't be much difference if you continue picking items that
go with the original commands, although you will somestimes get
"which object? [*]" when the only choices are for alternate command.
And you won't see the all-four-accessories-are-already-worn message
for 'P' unless you also have something worn in all seven armor slots.
The Guidebook.mn changes have been tested (that's how/why I noticed
the preface glitch) but the corresponding Guidebook.tex ones haven't.
PatR [Sun, 2 Aug 2015 08:54:51 +0000 (01:54 -0700)]
obj bypass: move vs turn
Reported by ais; clearing object bypass bits once per turn isn't often
enough. Clear them after the hero moves (which might be more than once
in a turn) and before each monster moves (ditto) and after last monster
moves. This might not be optimal but that shouldn't matter since it's
usually a no-op.
Add macros W_WEAPON and W_ACCESSORY, similar to existing W_ARMOR, bitmask
of all the relevant worn bits. Just for code readability; there should
be no change in behavior.
Also, reformat the "ugly checks" portion of getobj(). Slightly better
readability and fewer continuation lines, but only a modest improvement.
I have several psssages for Maskerade too, but after the time and effort
spent fixing up the ones already present for that book, they'll have to
wait until some other occasion.
Replace instances of strings split across lines which rely on C89/C90
implicit concatenation of string literals to splice them together
with single strings that are outdented relative to the code that uses
them. It's uglier but it won't break compile for pre-ANSI compilers.
This covers many files in src/ that only have one or two such split
strings. There are several more files which have three or more. Those
will eventually be '(2 of 2)'.
Noticed along the way: the fake mail message/subject
Report bugs to devteam@nethack.org.
wasn't using its format string of "Report bugs to %s.", so would have
just shown our email address. Doesn't anybody enable fake mail anymore?
I modified that format to enclose the address within angle brackets and
made a similar change for the 'contact' choice of the '?' command.
Pasi Kallinen [Fri, 10 Jul 2015 13:17:01 +0000 (16:17 +0300)]
Fix dark_room glyphs when restored from save
If color or dark_room options were toggled during gameplay, and then
the game is saved and restored with different options, the dark room
glyphs were wrong.
%o[hij] relied on makesingular() converting "the Eyes of the Overworld"
into "the Eye of the Overworld" to recognize when it should use
they/them/their instead of it/it/its, but makesingular() was changed to
keep "eyes" intract instead of stripping the 's'. So qtext_pronoun()
needs to check for "Eyes" itself.
Add summary lines for the deliver-by-window messages of the Healer
quest. Also, replace a bunch of hard-coded pronouns for leader,
nemesis, and in one case, patron deity in the Healer messages plus
the three roles which precede it (Arc, Bar, Cav).
The breakfast+coffee+doughnut one is by the far the longest we've had,
but I decided not to try trimming any of it out. It was at the start
of a 10 page stretch that has six good passages, but I've only included
three of them.
I've got passages for two more books queued up, but transcribing and
proofreading is a chore....
Add new entries to the menu used for the '/' command: describe nearby
monsters, describe all shown monsters, describe nearby objects, and
describe all shown objects. It makes a text window listing monsters--
or objects--currently displayed on the map, showing lines of
X r,c monster-or-object description
where 'X' is symbol (monster or object class letter for tty), 'r,c' is
row and column separated by comma, and description is similar to what
using '/y' or ';' manually would provide (how-seen info is omitted
when listing monsters).
Originally intended for blind players using screen readers to describe
what is displayed, but will probably get used by other players too.
The map doesn't use a separate set of glyphs for objects which are the
tops of piles, so the information that there are additional objects
beneath the ones shown isn't available to '/' and ';'. That feels like
a bug to me....
If you've just received the "dead bat revives as a vampire" message,
suppress the rather obscure "Maybe not..." message given when an unseen
creature gets life-saved since it ends up being out of sequence. You
could get them both when the death/revival was sensed via telepathy
without being in sight.
Also, some formatting cleanup and a couple miscellaneous code tweaks.
Implement the requested feature to have an automatic annotation on the
dungeon level with the quest entry portal where you sense the leader
summoning you. It stays even after entering the portal (which results
in another automatic annotation of "portal to quest"), up until you
return to that level after having completed the quest.
Add a second one for the quest home level once the leader has given
you the go ahead to start the quest. After completing the quest that
one remains but its wording is changed.
This ought to haved incremented EDITLEVEL but I decided to risk leaving
current save files viable. That should work ok for anyone who isn't
overriding the default definition of Bitfield(), although odd behavior
could conceivably occur. New games have nothing to worry about.