Commit Graph

5336 Commits

Author SHA1 Message Date
nhmall
df4458cb3a Merge branch 'hallutraps' of https://github.com/copperwater/NetHack into copperwater-hallutraps-3.7 2019-10-02 13:02:22 -04:00
nhmall
b139d4f869 Merge branch 'NetHack-3.6' 2019-10-02 09:36:36 -04:00
nhmall
1df652683e allow orctown booty items to be initialized in mksobj 2019-10-01 21:06:07 -04:00
nhmall
37e10a0cd9 Merge branch 'NetHack-3.6' part 2 2019-10-01 20:51:07 -04:00
nhmall
642f698a7a Merge branch 'NetHack-3.6' 2019-10-01 20:44:57 -04:00
nhmall
72252d5dc6 follow-on bits 2019-10-01 17:47:45 -04:00
nhmall
29946b551b autopickup exception priority in pull request 226
The pull request #226 commentary follows:

One major limitation of the autopickup exception system is that you can't
define an exception from an exception, despite both menucolors and msgtypes
prioritizing rules based on the order they are defined in .nethackrc. This
is because the "always pickup" and "never pickup" exceptions are tracked in
different lists, and at runtime, when the player steps over an object, the
game checks these lists seperately, with "never pickup" taking precedence.
This means that if you want to pick up some but not all items matching a
given expression, you may need to write a long and kludgy list of regexes
to get the behavior you want.

I've edited the autopickup exception code to remove this necessity: now
the exceptions are stored in one list, and conflicts between them are
resolved based on their relative position in that list. Whether an
exception was inclusive or exclusive was already tracked individually;
I don't know why they were stored separately in the first place. This
edit makes the system both more convenient and more consistent with the
semantics of menucolors and msgtypes.

With these changes, the 33 autopickup exception rules in the wiki article
linked above may be replaced with the following 7 much simpler rules for
the exact same effect:

AUTOPICKUP_EXCEPTION=">.* corpse.*"
AUTOPICKUP_EXCEPTION="<.* newt corpse.*"
AUTOPICKUP_EXCEPTION="<.* lichen corpse.*"
AUTOPICKUP_EXCEPTION="<.* lizard corpse.*"
AUTOPICKUP_EXCEPTION="<.* floating eye corpse.*"
AUTOPICKUP_EXCEPTION="<.* wraith corpse.*
AUTOPICKUP_EXCEPTION=">.*\>.*"

closes #226
2019-09-30 10:54:03 -04:00
nhmall
657b65bd3c Merge https://github.com/Vivit-R/NetHack into Vivit-autopickup-exceptions-3.6 2019-09-30 10:48:18 -04:00
HMM
ca95246903 Remove redundant function "count_ape_maps" 2019-09-30 02:12:06 -04:00
nhmall
c26914bb55 Merge branch 'NetHack-3.6' 2019-09-28 20:23:05 -04:00
HMM
1f5e619887 Delete unusued local variable 2019-09-27 15:42:50 -04:00
HMM
f68561fbe1 Fix check_autopickup_exceptions to return null pointer if no exception is found 2019-09-27 15:17:53 -04:00
nhmall
da6c393e43 fix errant verb tense in some messages if pet or mon name ends in 's'
Report stated:
"Poes deliberately slither onto a polymorph trap!" ... it's only one cat, er,
black naga. Why does the parser treat the name as plural? There are lots of
singular words and names that end in -s or -es!

H9249 1780
2019-09-26 11:49:15 -04:00
nhmall
5a6d70a952 Merge branch 'NetHack-3.6' 2019-09-24 21:03:52 -04:00
HMM
234e5f38f2 Clean up stray comments 2019-09-24 20:05:37 -04:00
HMM
098e3e5b3e Merging in autopickup exception rework 2019-09-24 19:12:54 -04:00
HMM
2fb9cf7a1c Rework autopickup exceptions to override one another like menucolors 2019-09-24 18:20:49 -04:00
nhmall
9361e872b2 fix uarmh null pointer dereference
uarmh null pointer dereference if a helm of opposite alignment came off due
to being polymorphed

fixes #225
2019-09-24 12:32:58 -04:00
nhmall
7ab824eb40 Merge branch 'NetHack-3.6' 2019-09-23 20:46:38 -04:00
PatR
348f968132 fix add_to_minv panic when aklys kills enfulger
Reported directly to devteam rather than via the web contact form:
throwing wielded aklys while swallowed would hit the engulfer and
return to the hero's hand but leave a stale 'thrownobj' pointer if
the monster survived.  Under usual circumstances, throwing anything
else or throwing the aklys again when not engulfed would clear that
pointer, putting things back to normal.  However, killing any engulfer
with the same weapon would try to add it to engulfer's inventory to
be dropped as it died.  If the killing blow was via melee rather than
another throw, the object in question would still be in hero's
inventory instead of free, hence panic.

The initial returning-aklys implementation shared Mjollnir's code
which doesn't have this issue.  This reverts from having attached
aklys always returning successfully when thrown while swallowed to
Mjollnir's 99% chance of return and 99% to be caught when it does
come back.  (That was already the case if the engulfer was killed by
the throw, where hero wasn't swallowed anymore after the damage was
inflicted.)
2019-09-23 15:16:39 -07:00
nhmall
bd26d2edbe correct spelling mistake on stupefied
As reported in github issue 224

Fixes #224
2019-09-23 14:19:15 -04:00
nhmall
4da223ba45 Merge branch 'NetHack-3.6' part 2 2019-09-23 01:05:52 -04:00
nhmall
04526c8e20 Merge branch 'NetHack-3.6' 2019-09-23 01:01:34 -04:00
PatR
0434437e99 fix #H9232 - message phrasing for openholdingtrap
Zapping wand of opening or spell of knock at self while trapped:
"You are released from pit."
ought to be
"You are released from the pit."
Likewise for most of the other held-in-place situations.

Also, when released like that vision wasn't being recalculated right
away to update line of sight to reach beyond the edge of the pit.
2019-09-22 15:03:52 -07:00
nhmall
89feb0cad0 Merge branch 'NetHack-3.6' 2019-09-21 10:52:13 -04:00
PatR
b1154399f1 fix github issue 223 - rubbing ring on touchstone
Fixes #223

The touchstone code treated all rings as if they had gemstones, but
quite a few don't and feedback could be unexpected.  Cited case was
an iron ring yielding a cyan (hi_metal) streak instead of the normal
iron result ("scritch, scritch").  A gold ring yielded a yellow
streak rather than a golden scratch.  I didn't test silver ring but
suspect it yielded a silver streak rather than a silvery scratch.

This changes touchstones to treat non-gemstone rings like other
classes of objects instead of like gems.  I made mineral rings keep
acting like gemstone rings--I'm not sure whether that's right.
2019-09-19 12:48:41 -07:00
PatR
6569631180 fix github issue 221 - unfixable troubles
Fixes #221

Routine unfixeable_trouble_count() is used for both applying a unicorn
horn (possibly internally via #monster if poly'd into a unicorn) and
drinking a blessed potion of restore ability.  For the latter case, it
always gave the wrong answer (unless the hero happened to be all of
Sick and Stunned and Confused and Hallucinating and Vomiting and Deaf).
Since the actual count wasn't used to decide whether hero felt "great"
or just "good", having any of those conditions would hide the problem.
2019-09-18 11:37:11 -07:00
nhmall
e5fc5efd21 Merge branch 'NetHack-3.6' 2019-09-17 08:25:45 -04:00
PatR
5589a16d74 github pull request - "You are <a foo>[.]"
Fixes #215

A post-3.6.2 change added a message for life-saving which lack its end
of sentence punctuation.
2019-09-14 18:00:39 -07:00
PatR
7c2b7d4417 github pull request - fake mail
Fixes #216

A github pull request changed one of the fake mail messages so that
our web site's URL is added at compile time instead of being hard-
coded.  However, it wouldn't compile with a pre-ANSI compiler since
it relied on concatenating adjacent string literals.  This is more
complex but achieves the same result, and also makes the existing
run-time subsitution be a bit clearer.

Testing was a hassle but eventually successful.
2019-09-14 17:52:02 -07:00
nhmall
32cfa8c675 Merge branch 'NetHack-3.6' 2019-09-08 10:39:57 -04:00
PatR
1a97dce727 fix github issue 218 = hallu vs passive gaze
Fixes #218

Hallucinating hero has 75% to be unaffected by a gaze counterattack
that paralyzes.  Check for that before checking free action (100%
chance to be unaffected).  The only change is that player might get
different feedback when both forms of protection against the gaze.
2019-09-06 14:39:25 -07:00
PatR
c53a72162c fix github issue 210 - dead code in sp_lev.c
Fixes #210

Subject was 'Bad loop condition in sp_lev.c'.  Some object creation
code had handling for something that couldn't happen due to the logic
leading up to it.  I couldn't figure out any way to make it useful so
just remove the dead code.
2019-09-06 14:27:40 -07:00
Pasi Kallinen
6426e61860 Prevent a possible impossible when guard relocated a monster 2019-09-06 22:09:03 +03:00
nhmall
73502fc79f Merge branch 'NetHack-3.6' 2019-09-02 10:10:37 -04:00
PatR
8cf70f7771 fix github issue 217 - monster spellcasting feedback
Fixes #217

Feedback when spellcasting monster aimed at the wrong spot due to not
being able to see an invisible hero only gave the intended message if
hero couldn't see self.  The code was using 'if (Invisible)' which
checks whether the hero is invisible and can't see invisible, when it
should have been using 'if (Invis)' which just tests whether the hero
is invisible.

It wouldn't surprise if the same problem occurs elsewhere.  Those
macros are rather error prone.

The issue report mentions that one of the affected messages might be
unreachable.  I didn't investigate that.
2019-09-02 02:59:09 -07:00
nhmall
06a742c081 Merge branch 'NetHack-3.6' 2019-08-31 22:58:20 -04:00
PatR
d8598bd6bb 'O' vs perm_invent (mostly)
Update persistent inventory window if 'implicit_uncursed', 'menucolors',
or 'guicolor' is toggled.  (curses should be changed to use menucolors
instead of guicolor to decide whether menu coloring is used.  Right now
it requires that both be On.)

Also, EDIT_GETLIN was providing junk default response when message type
or menu color looped and prompted for another entry after handling one.

Mixed in with this is a fix for easily induced buffer overflow which
has security ramifications....
2019-08-31 01:38:19 -07:00
nhmall
db5d353d7c Merge branch 'NetHack-3.6' part 2 2019-08-30 22:16:30 -04:00
nhmall
a36792162c Merge branch 'NetHack-3.6' 2019-08-30 22:11:44 -04:00
PatR
3e0d029a45 fix #H9164 - crash during restore when swallowed
Subject was "display crash while in curses mode".  Restoring with
perm_invent set in config file or NETHACKOPTIONS when the save was
made while swallowed (regardless of perm_invent at that time) resulted
in a crash when invalid u.ustuck was referenced before restoration had
done its pointer fixups.

init_nhwindows() is called with perm_invent On;
restgamestate() temporarily turns it Off (3.6.2 restore hack);
if/when update_inventory() gets called, curses notices that the
persistent window has been disabled so it tears down all its windows
in order to redraw the screen without that one;
docrt() sees non-Null u.ustuck and calls swallowed();
swallowed() tries to use the value of that pointer rather than just
Null/non-Null but the value is from the previous game session, not
valid for the current session;
crash.

Make yet another attempt to prevent update_inventory() from being
called during restore.  curses won't try to redraw and the crash
won't happen.  But the invalid pointer is still lurking (until an
eventual fixup later during restore).

An earlier fix for update_inventory() during restore actually handled
this problem (for the most common trigger, setworn(), but not in
general), so the 3.6.2 behavior is a regression.
2019-08-30 18:11:43 -07:00
nhmall
8a328ff7eb quite some Xcode warnings 2019-08-17 12:55:48 -04:00
nhmall
7f46365fb1 Merge branch 'NetHack-3.6' 2019-08-15 21:07:45 -04:00
PatR
a995929168 fix #H9118 - stoning a sandestin
causes "dmonsfree: N removed doesn't match N+1 pending" warning.  The
sandestin monster definition flags it as MR_STONE, immune to being
turned to stone.  If the hero hit it with a cockatrice while it was
shape-changed into something which isn't MR_STONE, it had its mon->mhp
set to 0, so died, and its form (mon->data) was set back to sandestin.
known_hitum() decided that it didn't turn to stone because of MR_STONE
for that form so proceeded to kill it off due to lack of hit points,
causing it to die twice.

I started to change that so that it didn't kill off the critter a
second time, bit it really shouldn't be able to kill it by stoning in
the first place.  So sandestin how shares some vampire code to revert
to innate form and not turn to stone when "killed" by stoning.  It
only yields the normal visible polymorph message:  "the <foo> turns
into a <bar>" without any attempt to explain why.  Once in sandestin
form, smacking it with a cockatrice corpse doesn't do anything special
(due to MR_STONE now being unambiguously in effect).  It will soon
shape-change to some other form and then become subject to being
forced back to innate shape by stoning again.
2019-08-14 18:49:16 -07:00
nhmall
899311efde merge correction bit 2019-08-14 08:21:21 -04:00
nhmall
c425c37097 Merge branch 'NetHack-3.6' 2019-08-13 16:32:53 -04:00
PatR
c814ca8e04 fix #H9117 - bookeeping for fatal status condition
When Stoned, Slimed, Strangled, Sick (TermIll or FoodPois or both)
counts down to 0 without being cured, keep it listed as an active
condition while killing off the hero.  It will show in the status
section when disclosing final attributes and in both that section
and map's status lines when producing a dumplog.
2019-08-11 18:56:43 -07:00
PatR
a2a257a512 fix github issue #211 - wrong parentheses
Fixes #211

dopickup() was getting the wrong value from pickup_checks() due
to misplaced closing parenthesis.  But it didn't actually impact
play; picking things up from engulfer's minvent while swallowed
worked even though the special check for that was failing.  The
code which was accidentally being skipped can probably go away but
I haven't gone that far.
2019-08-08 11:25:36 -07:00
PatR
cc3d97d9b3 fix github issue #209 - typo in end_of_input()
Fixes #209

Fix typo:  program_statue should be program_state.  Apparently
NOSAVEONHANGUP+INSURANCE isn't used by anyone since it wouldn't
compile.
2019-08-08 11:01:56 -07:00
nhmall
dbc2e69110 Merge branch 'NetHack-3.6' 2019-08-02 22:50:13 -04:00