Commit Graph

6352 Commits

Author SHA1 Message Date
Pasi Kallinen
bbc3cee759 Fix minor diffs between Guidebook.mn and .tex 2017-08-17 23:30:36 +03:00
Pasi Kallinen
00aae6b684 Remove erroneous bolding from Guidebook.mn 2017-08-17 23:18:41 +03:00
PatR
70c62882bf add missing fixes entries for curing blindness 2017-08-16 15:08:36 -07:00
PatR
0840974b42 nurse corpse vs blindness
The carrot patch made monsters (carnivorous pets, g.cubes) who eat
nurse corpses have temporary blindness be cured.  Do the same for the
hero.
2017-08-14 16:42:44 -07:00
PatR
5f3e11687c healing vapor vs blindness
Drinking any potion full healing or extra healing or non-cursed potion
of healing cures blindness in addition to restoring lost hit points.
Now breathing vapor from any potion of full healing or non-cursed
potion of extra healing or blessed potion of healing will also do so.
2017-08-14 16:36:37 -07:00
PatR
5e54397609 fix #H5853 - carrots don't cure blind pets
Report was for a blinded horse which ate a carrot but remained blind.
This fixes that, and also lets blinded carnivorous pets eat carrots.
Gelatinous cubes now handle carrots too, but since they lack eyses
there won't be any noticeable effect for them.
2017-08-14 16:30:23 -07:00
PatR
fd74f2e149 fix files.c part of #H5778 - file descriptor leaks
Fix the SELF_RECOVER part of files.c which was actually in slightly
worse shape than previously fixed recover.c itself.

I think the HOLD_LOCKFILE_OPEN edition of nhclose() is the only
remaining file descriptor leak from the original #H5778 report.

The revised code compiles when SELF_RECOVER is defined, but I didn't
actually force a recovery to fully test it.

This patch includes a couple of reformatting and/or reorganization
bits in addition to the fd leak fix.
2017-08-12 16:44:39 -07:00
PatR
e8723df778 grappling with water
Reported directly to devteam:  if applying a grappling hook towards
a target past some water ended up pulling the hero toward the target,
hero would drown without any chance of crawling out of the water.
It used hurtle() to move, and hurtle assumed levitation so didn't
check for entering pools of water except on the Plane of Water.
2017-08-08 18:58:25 -07:00
PatR
1e15fdcb77 rereformat winprocs.h
Overriding clang-format was justified, but the result was too wide.
Make the lines less that 80 characters.

Also, WC_PERM_INVENT and WC_PLAYER_SELECTION had comments cloned from
the preceding line.
2017-08-07 14:27:15 -07:00
Pasi Kallinen
152ddf4a4b Unify strength string 2017-08-06 22:56:07 +03:00
Pasi Kallinen
1f671b962c Demangle clang formatted code 2017-08-06 20:27:48 +03:00
Pasi Kallinen
4e05de9bff Add whatis_moveskip option to change fast-moving cursor
Previously the "fast-moving" when getting a target location
was always by 8 units. If this option is on, fast-moving
will instead skip the same map glyphs. This should be much more
useful for blind players.
2017-08-06 15:41:31 +03:00
PatR
1614f8f5ee fix brace mismatch in winami.c
Reported directly to devteam, so no #H number.  Conditional code in
amii_get_ext_cmd() included an unmatched '{', which would break
compilation (at least if EXTMENU was enabled) and also resulted in
the remainder of winami.c being mis-formatted (the functions there
were treated as being inside a block rather than at file level).

This is completely untested.

There's some code suppressed via '#if 0' with a comment "fix for PL2".
We haven't used the patch-level nomenclature since version 3.0!
2017-08-05 17:58:20 -07:00
PatR
0d7101cd29 fix part of #H5778 - file descriptor leaks
Handle the part of #H5778 in sys/atari/tos.c.

The part in util/recover.c has already been fixed; the part in
src/files.c still needs to be fixed.
2017-08-05 17:29:24 -07:00
Pasi Kallinen
4d7d63814a Throne room's throne is occupied by a king
Based on a patch by Leon Arnott
2017-08-04 23:15:30 +03:00
Pasi Kallinen
b6d1ee3320 Using a cursed tin whistle in a vault summons the guard
...since guards respond to shrill whistles.
Based on a patch by Leon Arnott.
2017-08-04 22:41:26 +03:00
Pasi Kallinen
e2904012b7 Show current timeouts in #wizintrinsic 2017-08-04 21:41:04 +03:00
PatR
b90c5d5c4f USE_OLDARGS update (3 of 2 :-)
Handle the few variadic calls in pline.c a better way.
2017-08-03 16:31:55 -07:00
PatR
3b675c5b49 USE_OLDARGS update (2 of 2)
Files modified:
include/extern.h
src/pline.c, priest.c, potion.c, mkobj.c

A bunch of calls to pline() in pline.c started triggering warnings
either as-is or possibly after the changes to tradstdc.h.  Fixing
them in place would include intrusive VA_PASSx() like in lev_main.c.
Moving them to other files is much simpler (and they didn't
particularly belong in pline.c in the first place, although I didn't
actually find any better place for them....).

The probing/stethoscope feedback went to priest.c, where there's a
comment stating that it should move to wherever englightenment ends
up once that is moved out of its completely inappropriate current
home in cmd.c.  (Holdover from when ^X was wizard-mode only but even
the other wizard mode commands don't really belong with the command
processing code.)
2017-08-02 18:56:54 -07:00
PatR
64f284dd61 USE_OLDARGS update (1 of 2)
Files modified:
    include/tradstdc.h, sp_lev.h, system.h
    util/lev_main.c

Silence a bunch of warnings generated by recent gcc which weren't there
with whatever version I had when 3.6.0 was being readied for release.
For lev_main, there were two basic types:  not enough arguments in calls
to lc_pline, lc_warning, and lc_error (since we weren't passing dummy
arguments as is done for add_opvars), and conversion from 'int' or
narrower to 'char *' (from -Wint-to-pointer-cast, which either wasn't
there yet in the older gcc, or wasn't included in -Wall back then).
[Note that for any configuration decrepit enough to actually need
USE_OLDARGS, such conversions will either work fine or else nethack
simply won't be viable.]

src/pline.c generates a bunch of warnings (for USE_OLDARGS).  The fix
for that will be (2 of 2).

To test, instead of mucking about with CFLAGS or sys/unix/hints, I've
been temporarily adding unconditional
|#undef USE_STDARG
|#undef USE_VARARGS
|#define USE_OLDARGS
to the end of config1.h and then doing my normal build--which is why
-Wall (or possibly -W) is drawing -Wint-to-pointer-cast warnings.
2017-08-02 18:23:42 -07:00
Pasi Kallinen
b4e4d70008 Fix couple static code analyzer warnings 2017-08-02 19:48:44 +03:00
Pasi Kallinen
b13bae91dc Add way to cycle through valid locations for polearm or jump target 2017-07-31 19:10:26 +03:00
Pasi Kallinen
439028dcae Add whatis_filter option to filter eligible map locations for travel
Compound option whatis_filter, filters the eligible map locations
when getting a cursor location for targeting. Accepts 'n' (none),
'v' (map locations in view), or 'a' (map locations in the same area,
eg. room or corridor).
2017-07-31 16:58:23 +03:00
PatR
6b851e0503 fix misplaced #if in sys/msdos/pckeys.c
Reported directly to devteam, so no #H number.  If SIMULATE_CURSOR
isn't defined, there would be no switch statement to attach the
subsequent cases to.

The suggested fix is obviously correct, but untested....
2017-07-30 18:43:47 -07:00
PatR
e4d4becfa2 fix #H5781 - missing fprintf args in wc_trace.c
This compiles cleanly after the fixes, but is otherwise untested.
2017-07-30 18:33:28 -07:00
PatR
b4240e1772 fix #H5780 - file pointer freed twice
win/share/tileset.c seems only to be used by the MSDOS port, but it
compiles cleanly on OSX after these changes.

A file pointer was passed to fclose() twice, second time potentially
causing problems.  There were cases of potentially null pointers
being passed to free() too.  That should be safe these days, but it's
something we've tried to hard to avoid and would probably trigger
complaints from our own MONITOR_HEAP code if that ever got applied
here.
2017-07-30 18:17:00 -07:00
PatR
e3c4ac730d util updates: lev_main.c and recover.c
Change lev_comp's add_opvars() to be like pline(), where there's a
single visible opening brace and a second one hidden in VA_DECL2
that introduces a nested block, plus a single visible closing brace
with a hidden one in VA_END() to close the nested block.  This
addresses the erroneous report (sent directly to devteam, so no #H
number, subject "missing '{' in util/lev_main.c:634") that the code
for !USE_STDARG/!USE_VARARGS in add_opvars() wouldn't compile.

Also, fix the part of "#H5778: file descriptor leaks" dealing with
util/recover.c -- an open file not being closed after various errors.
I didn't take responsibility for this entry in the bugzilla list
since the report includes similar problems in other code that's not
addressed here.

And a blast from the past:  some reformatting fixups in recover.c.
The most interesting bit is for a block of dead code....
2017-07-30 17:34:52 -07:00
PatR
27f9a83a0b mons[0]
Alex mentioned that loops over mons[] were starting at [0], which
should be [LOW_PM] instead.  I only found two, and the mvitals[] one
was benign.  The special level one might have been too, depending
upon spec_lev's thoroughness--I didn't attempt to check.

Once upon a time there was a possibility of moving 'playermon' from
a separate variable to mons[0], so LOW_PM became the index of the
first valid monster.  Instead, 'playermon' went away altogether.
LOW_PM (and NON_PM) could go away too, but I don't see how reverting
to hardcoded 0 and -1 would be an improvement.  We have enough
problems as it is with "giant ant" turning up in unexpected places
because someone used 0 instead of NON_PM to mean "none of the above".
2017-07-16 15:28:44 -07:00
PatR
d17858f947 health recovery
This started out as just an attempt to remove some duplicated code,
but mutated.  Move health recovery into a separate routine to
streamline moveloop().

Intentional changes:
1) when poly'd hero is at max u.mh (hit points as a monster), do
   not recover lost u.uhp (hit points when in normal form).  That
   was caused by a missing !Upolyd check in the long if..elseif..
   elseif..endif logic.  If we want to make it deliberate, I think
   some u.uhp recovery in rehumanize() would be the way to go.
2) regeneration for poly'd hero in sea monster form (ring worn on
   left or right pectoral fin) now counteracts the loss of hit
   points for turns spent out of water.  [Do eels even have fins?]
3) poly'd hero with moderate or worse encumbrance and lacking
   regeneration wouldn't recover any health.  Now he/she will do so
   if not moving [on the magic (moves%20 == 0) turn when u.mh
   recovery takes place].

If there are any other changes in behavior, they're unintentional.
2017-07-15 18:24:56 -07:00
Alex Smith
1c026727fb Remove obsolete code allowing 1-indexing the monster list
Having selectable base indexes for the monster list doesn't seem
likely to be needed in the future any more, now that the code for
the monster list is stable. Additionally, the functionality in
question has bitrotted heavily (e.g. many "loops over all
permonsts" start at a hardcoded 0, which wouldn't work with a
1-indexed monster list). As a result, removing the relevant code
in makedefs makes it clearer what can and can't be assumed about
the code, reducing the risk of bugs in the future.

Thanks to FIQ for mentioning that this could be an issue.
2017-07-15 01:34:41 +01:00
PatR
fe4583fc88 some artifact.c formatting
I managed to separate these bits from the touch/retouch fix.
I almost threw then away, but one's a spelling fix in a comment.
2017-07-12 18:02:52 -07:00
PatR
c0bb25b388 fix commit ebd6bb62f5 : #H4383 - blasted twice
by Excalibur.  Noticed on Reddit by Alex, the attempt to fix being
blasted twice by wielded artifact weapon when changing alignment
ended up preventing wielding other role's quest weapons.  At the
moment I can't even see how it prevented the double-blast....

This backs out that change and fixes the double-blasting correctly.
When uwep and uswapwep are tested in advance of the rest of invent,
mark them as already processed before entering the loop that checks
all not-yet-processed inventory.
2017-07-12 17:53:04 -07:00
PatR
a573134d7e fix #H3013 - grammar bug with named fruit
Reported nearly four years ago for 3.4.3, original subject was
\#H3013: NetHack grammar bug when taking unpaid fruit from chest

Player used OPTIONS=fruit:Quorn and the capitalized value confuses
the() into thinking it's a proper name which shouldn't be preceded
by an article, resulting in "Quorn will cost you N zorkmids" when
removing it from a chest in a shop, followed by "X - a Quorn (unpaid)"
as it went into inventory.  It is a product name, but when used as a
fruit it shouldn't be treated as a proper name.  (Quorn is a meat
substitute rather than anything related to fruit.)  Teach the() about
named-fruits, so that we'll get "The Quorn will cost you N zorkmids."

Unfortunately, it means that someone who names their fruit after a
proper name used by the program, for example Mjollnir, can probably
induce other poorly worded messages (about the item rather than the
named-fruit).  the() is used all over the place and all it has to work
with is text, not the object whose formatted name produced that text.

I looked through a bunch of old cvs log messages last night, and
spotted one I wrote (in objnam.c) a dozen years ago where I suggested
forcing named-fruit values into lower case as they're being set up.
I don't remember that, but if we'd done it, this bug would have been
avoided.
2017-07-04 18:44:03 -07:00
PatR
7a8559a34d releaseobuf() fix
The object name formatting routines operate using a pool of buffers to
hold intermediate and/or final result.  Some routines consume multiple
intermediate buffers, so use releaseobj() to try to reuse just one in
order to avoid churning through too many and maybe clobbering live
data.  It worked as intended for routines that use nextobuf() directly
but wouldn't haved worked right for xname(), also doname() and other
xname() callers.  This fixes that.

There have never been any reports of garbled messages which could be
traced to clobbering of formatted object names, so this fix is mostly
academic.
2017-07-04 14:47:00 -07:00
PatR
ca84c8e0ff named-fruit manipulation
Add some new routines for dealing with fruit.  I had hoped they would
let the existing fruit handling be simplified quite a bit, but the
improvement wasn't great.  However, they're also groundwork for fixing
an old bug.
2017-07-03 18:57:50 -07:00
PatR
fa2fbb64c8 tribute typo 2017-07-02 14:36:01 -07:00
PatR
d7e7c620f5 wishing for tins
A couple of days ago when verifying the report about being forced to
pay for a second tin when eating one from a stack on a shop's floor,
wishing for 'tins' (rather than 'tins of foo meat') was repeatedly
producing tin wands instead.  The name "tin" and the wand description
"tin" in objects[] were being given 50:50 chance for either one by
the 3.6.1 wishing code.  Wishing for "tins of spinach" also gave me
a tin wand on the first attempt.  Handle 'tin(s)' more explicitly.

This also does some reformatting.
2017-07-01 14:22:42 -07:00
PatR
36a921ca3b more obj filtering
Add support for filtering by unpaid status for container-in and
container-out actions.  When taking out of a container, it works as
expected if you're carrying the container while in a shop, but won't
find any unpaid items if the container is on the floor.  That's
because they're only flagged as unpaid while in the hero's inventory.
(And when it doesn't find any unpaid items it won't list 'unpaid' as
a category of item to manipulate, so while that might be suboptimal
for taking items out of shop containers, it shouldn't be a problem.
Typically all the contents are shop-owned anyway, so using unpaid as
a filter wouldn't gain any advantage over just taking stuff out.)
2017-06-30 23:51:14 -07:00
PatR
a45ac9955f fixes36.1 update: #H4725 - repeated shortcut keys
Mark an old 'unconfirmed' bug as 'fixed'.  The report was for win32gui
and I can't reproduce the problem or verify that it's gone, but I'm
sure enough about the cause and long-ago fix to put #H4725 to rest....

Report was that the menu for the name-from-discoveries-list command
was reusing a set of punctuation characters for each class of objects.
The key was that '!' was always first, and it is (' ' + 1) so the core
bug of erroneously specifying space for a selector on object class
header/separator lines was being used as the start of the selector
sequence.  (Report that led to the fix was that typing space on that
menu always made it finish instead of advance to the next page.)
2017-06-30 16:31:54 -07:00
PatR
67c1325a81 tribute: The Amazing Maurice
and His Educated Rodents.  The last Discworld book with only one or
two passages to choose from when reading.
2017-06-30 02:09:56 -07:00
PatR
ff6139c6c5 robustness of #timeout and #wizintrinsic
Remove the assumption of property index values from the list of
property names.  Move the properties that can't have timed values
in normal play to after those which can.  (Mainly only matters for
the #wizintrinsic command.)

Bug fix: #wizintrinsic variable 'any' wasn't initialized properly
if 'a_int' is smaller than a long or a pointer.  The separator line
I've added was ending up as a menu choice.
2017-06-29 17:54:01 -07:00
PatR
f9af42a2b7 eating 1 of N floor tins in shop
Reported directly to devteam, eating 1 of 2 tins of spinach from a
shop's floor forced the hero to buy both.  (1 was gone, the other was
intact and now owned by the hero rather than the shop.  Tins of other
contents behaved similarly.)  The bug is easy to fix but not so easy
to explain:  eating split one from the stack but passed the remaining
stack to useupf(obj,1) which also split one off and treated that as
used up.  The second one was billed as used up and the first one was
added to the bill--as being subjected to a costly modification made by
the hero--and kept intact, now marked no-charge with hero obligated to
pay for it.

Eating 1 of N tins, for N greater than 2, billed for two, one gone and
the other now in a separate stack and marked no-charge.  The remaining
N-2 stayed as normal shop goods in their original stack.

The fix is communicate the splitobj() for costly modification up-call
so that the use_up_tin code operates on the one which was split off
the stack rather than on the remainder of the original stack.
2017-06-29 16:14:27 -07:00
PatR
27c24536af set 'bouldersym' via 'O'
Reinstate the deprecated 'bouldersym' option for the 'O' command
instead of just showing the set-at-start-of-play value.  I leave
boulder with the default value except when attempting to solve
Sokoban, and it's a pain to have to save, edit config file or
reset NEHTACKOPTIONS, then restore in order to change the boulder
symbol, then do that all over again once leaving Sokoban.

If using the default symbols, a custom symbol set which just sets
boulder will work, but with {DEC|IBM}graphics that's no help
because the unspecified symbols revert to their default values.
2017-06-27 18:11:00 -07:00
Pasi Kallinen
8180310630 Make #wizmakemap handle unpaid items and punishment 2017-06-28 00:40:00 +03:00
PatR
8e8ea0566b extend #timeout to cover all properties
Extend the wizard mode #timeout command:  show timeouts for all 67
intrinsics rather than just a handful.  Most won't appear because
they don't have any way to receive a timed value.  Except for...

Extend the wizard mode #wizintrinsic command:  allow setting a
brief (30 turn) timeout for any/every intrinsic, not just for
deafness.  It ought to prompt for duration, but that's more effort
than I'm willing to expend.  This might turn up lots of quirks that
the code isn't prepared to handle (like setting life-saving to
non-zero will break the assumption that it comes from worn amulet).
Perhaps some will warrant fixing, others just a shrug.

There are still some timed events that aren't listed by #timeout:
remaining duration to stay polymorphed in current form, number of
turns until it's safe to pray, luck decay, number of turns until
next attribute exercise/abuse check, probably others that I'm
overlooking.

Bug fix:  while testing, I observed
  Your limbs have turned to stone.
  You have turned to stone.
  You can hear again.
  You are a statue.
when deafness and petrification were timing out at the same time.
This modifies the stoning and sliming countdowns to extend deafness
duration a little if it's about to time out at the tail end of the
stoning or sliming sequence, so that "you can hear again" won't
happen until after life-saving.  There are probably other variations
of simultaneous or near simultaneous timeout that interact oddly.
2017-06-26 01:04:58 -07:00
PatR
8e213472c2 update wizhelp for ^O and #wizwhere
I think ^O changed when the dynamic key-binding code was incorporated.
It's a shortcut for #overview in all modes.  To get the old wizard mode
behavior, use #wizwhere.

Add an entry for #terrain, expand several of the descriptions, and fix
up the formatting (remove periods in ^ section, align text in # section).
2017-06-26 00:22:09 -07:00
Pasi Kallinen
05e6255bf8 Show more properties in wizmode #timeout 2017-06-25 16:13:23 +03:00
PatR
e32c09c5bf BUCX filtering
The different menustyle settings have been offering different degrees
of support for BUCX filtering:
  Full       : multi-drop, container-in, container-out
  Trad, Combo: multi-drop
  Partial    : none (to be expected; it explicitly jumps past class
    filtering, where BUCX gets handled, to a menu of all objects)

This adds pickup, container-in, container-out, multi-unwear/unwield,
and object-ID for Trad and Combo, and multi-unwear/unwield for Full.
(Full behaves like Partial for pickup--not sure why--and for object-ID,
bypassing filters to go straight to a menu of all applicable items.)

There are probably several new bugs--this stuff is very convoluted....
2017-06-23 18:44:35 -07:00
PatR
6a84840971 address #H5426 - inventory category selections
Report #5426 was classified as not-a-bug, but the underlying issue
can be improved.

For item selection where BUCX (bless/curse state) filtering is
supported (mostly for menustyle:Full, but there are a few actions
where Traditional and Combination handle BUCX too), 3.4.3 took the
union of object class and bless/curse state (so ?!B gave all scrolls
and all potions and every blessed item from other classes) but 3.6.0
changed that to the intersection (so ?!B gives blessed scrolls and
blessed potions, period).  Since gold is inherently not blessed or
cursed it has been getting excluded during intersection handling
when that includes BUCX filtering.  Report #5426 was from a player
who was used to choosing $X when putting newly acquired loot into a
container asking to have the old behavior reinstated.

The ideal fix would be to support both union ($ | X) and intersection
(?! & B), but implementation would be bug prone and the interface,
especially when done for menus, would be cumbersome.  Instead, this
adds new boolean option, goldX, to allow the player to decide whether
gold is classified as uncursed--even though it is never described as
such--or unknown.  The new-loot-into-container issued can be solved
either via $abcX, where abc lists all classes that have any X items
(when gold is included as one of the classes, its BUCX state is now
ignored for the current selection), or by setting the goldX option
and then just picking X for the types of items to put into the
container (or drop or whatever other action supports BUCX filtering).

The situations where menustyle:Full allows BUCX filtering during
object class specification and styles Traditional and Combination
don't should to be fixed (by extending BUCX support to Traditional
and Combination rather than removing it from Full, obviously).
2017-06-21 14:02:13 -07:00
Pasi Kallinen
60443a4ee7 Add sanity checking for long worms 2017-06-16 18:27:25 +03:00