Commit Graph

2365 Commits

Author SHA1 Message Date
PatR
a7daa522a4 fix github pull request #114 - ant holes in *.des
Fixes #114

Report and contributed fix described lack of support for room type
"ant hole" in the code that loads special levels (and mentioned that
none of our des files attempted to use that room type so it isn't
noticeable in unmodified version of the game).  The fix overlooked
a couple of other missing room types (leprechaun hall and cockatrice
nest) so I didn't use the pull-request's commit (so not sure what
github's automated updating will make of 'Fixes #114').
2018-07-03 15:49:44 -07:00
PatR
335e868865 fix github issue #111 - stone-to-flesh of statues
Fixes #111

Casting stone-to-flesh at a random statue animates it as a monster
(created via direct call to makemon()) at an adjacent or nearby spot
if there is already a monster at the statue's spot, but doing so on
a statue of a petrified monster (create attempt via montraits() which
called makemon() without the ADJACENTOK flag) turned it into a corpse
instead.  Pass an extra argument to montraits() so that it behaves
the same normal statue animation for stone-to-flesh without changing
how it behaves when reviving corpses for undead-turning.
2018-07-03 14:59:34 -07:00
PatR
c04b652e40 hilite_status: score vs !SCORE_ON_BOTL
When built without support for SCORE_ON_BOTL (the default), suppress
'score' field from 'O' menus for adding/removing hilite_status rules.

Also, add "encumbrance" as field name synonym for "carrying-capacity"
and "experience-points" for "experience".  Relevant for rules set in
config file or via NETHACKOPTIONS.
2018-06-24 17:44:33 -07:00
PatR
699e65fa34 hilite_status attributes
Take a step towards eliminating merging hilite_status rules during
highlighting by creating a single rule instead of multiple ones
when specifying multiple attributes for the same highlight via the
'O' command's menus.

Old:
 (pick_one menu to pick a color) + (pick_one menu to pick an attribute)
| hilite_status:title/always/red&bold
 (pick_one menu to pick a color) + (pick_one menu to pick an attribute)
| hilite_status:title/always/red&blink
New:
 (pick_one menu to pick a color) + (pick_any menu to pick attributes)
| hilite_status:title/always/red&bold+blink

At present, rule selection during highlighting still merges multiple
applicable rules instead of finding the best one first, with the
problems that entails.

Bonus fix:  a hilite_status rule for status conditions which specified
"no attributes" would clear attributes for all previous condition
rules rather than just the one(s) in that "no attributes" rule.
2018-06-23 17:37:54 -07:00
PatR
8c2bd75ce4 fix github issue #110 - sortloot segfault
Fixes #110

NetHack dumped core while qsort was executing for sortloot.  Fix a
logic error introduced by adding filtering capability to sortloot()
which could result in a sparsely populated array instead of having
the number of elements be less than the list size.

I don't know why this didn't show up sooner.
2018-06-21 12:09:12 -07:00
PatR
800a898b51 fix github issue #109 - healing spells
Fixes #109

Spells of healing and extra healing cast at monsters were handling
monster blindness differently from other forms of healing.  (Potions
also work differently when drunk by monsters but I haven't changed
that since it seems to be intentional.)

Hero:
   potion of healing cures blindness if blessed; spell of healing
      cast at skilled or better now behaves likewise;
   potion of extra healing cures blindness if not cursed; spell of
      extra healing is inherently not cursed and already behaved
      likewise;
   potion of full healing always cures blindness even if cursed.

Monsters quaffing potions:
   plain healing cures blindness if not cursed;
   extra healing and full healing always cure blindess.

Hero casting healing spell at monster:
   plain healing behaves like the hero plain healing case:  cures
      blindness as if blessed when cast at skilled or expert level;
      this is a change in hehavior--it used to cure timed blindness
      even if unskilled and not cure 'permanent' blindness at all;
   extra healing cast by hero is inherently not cursed so always
      cures blindness.
2018-06-20 14:53:20 -07:00
PatR
9415797c65 fix githib issue #108 - wishing for mimic corpse
Fixes #108

"small"/"medium"/"large" prefix was being stripped off during wish
parsing so that it could be used to control glob size.  But those
are also prefixes for monster and/or object names.  Wishing for
"small mimic corpse" or "large mimic" corpse failed with "nothing
matching that description exists" when it tried to satisfy "mimic
corpse".  (Asking for "giant mimic corpse" worked as intended.)

Not mentioned in the report:  wishing for "large {dog, cat, kobold}
corpse" produced the corpse of corresponding normal sized critter
instead of that of a large one.

Noticed while testing the fix:  wishing for "glob" failed rather
than pick a random glob type.  Wishing for "glob of grey ooze"
failed even though "grey ooze" is recognized as a variant spelling
for the gray ooze monster.  Wishing for "<monster type> glob" also
failed even when the monster type was viable for globs.  This fixes
all of those even though no one will ever notice....

Wishing for "small box" (and "medium box") no longer yields a large
box, it fails with "nothing matching..." instead.  I was ambivalent
about the earlier change which had the unintended side-effect of
making them synonyms for "large box" so haven't tried to revive it.
2018-06-19 17:21:21 -07:00
PatR
4bce58f665 fix github issue #106 - polymorph panic
Fixes #106

If dipping a worn amulet into a potion of polymorph turns it into an
amulet of change, the game panics while trying to use up that amulet
when the new one hasn't replaced the old one in inventory yet.  Simply
reordering the relevant code isn't sufficient to fix things:  once it
is in inventory and can be successfully used up, later code would end
up deferencing a stale pointer because it was unaware of the deletion.
2018-06-17 16:59:58 -07:00
PatR
f81818e85d fix #H7226 - vault guard should have whistle
Implement the suggestion that since teleporting away from the vault
while being confronted by the guard results in a shrill whistling
sound, the vault guard ought to have a tin whistle in his inventory.

I also added a check that he does have the whistle and to give an
alternate message if not, but after half a dozen tries to have a
squad of beefed up monkeys steal the whistle, they never accomplished
that.  At least three times they took everything except the whistle
but I never succeeded in verifying the alternate message.
2018-06-15 16:24:02 -07:00
PatR
0b93d26269 sortloot - enhanced sorting [re-revamp anyone?]
When objects are in the same class, sortloot orders them by their
formatted name.  It was reformatting each object every time it got
compared to another object.  Change that to remember the formatted
name so that any given object is formatted at most once (during the
current sort; future sorts will need to format it again).

Armor and weapon classes are subdivided into smaller subclasses
and the formatting plus alpha compare is only done for items in
the same subclass, so helms come out before cloaks and don't get
their names compared, for instance.  [That was from my 'revamp'
rather than the original implementation.]  This adds a couple more
subclass sets:  food (named fruit, 'other' food, tins, eggs, corpses,
globs) and tools (containers, pseudo-containers [bag of tricks and
horn of plenty once those have become discovered; prior to discovery,
bag of tricks is classified as a container and horn of plenty as an
instrument], instruments, 'other' tools).

The main difference, aside from the formatting efficiency improvement,
is to change the previous sort order
| pink potion
| potion of enlightenment
| purple-red potion
to be
| pink potion
| purple-red potion
| potion of enlightenment
by grouping undiscovered items before discovered items when class and
subclass match.  So discovery state is essentially a sub-subclass and
formatting plus string comparison is only done for members of the
same sub-subclass.  There are actually four state values:  unseen
(which applies to particular objects rather than to their type),
unknown (not discovered and not named), named (not discovered but has
player-assigned type name), and discovered (either fully discovered
or considered not interesting to discover [no alternate description,
not nameable]).

My testing was primarily done with pickup ('m,' with menustyle:T)
and sortloot:Loot (the default) plus !sortpack (not the default and
not a setting I ordinarily use, but less verbose without the class
separators).  It won't astonish me if oddities crop up with other
usage combinations.
2018-06-12 16:33:35 -07:00
PatR
77d478c939 fix #H7205, #H7120, #H5216 - sortloot
H7205 - full-pack identify might skip items if perm_invent is on
        because updating the inventory window might reorder 'invent'
        while the identify code is in the midst of traversing it;
H7120 - pickup that doesn't pick anything up can change the glyph
        shown on the map because the pile might be reordered such
        that a different item is on top;
H5216 - performing a sortloot operation on a pile and then switching
        back to sortloot:none doesn't restore pile's original order.

The 'revamp' that changed the contributed sortloot feature to switch
to simpler usage (object list itself was sorted rather than having a
parallel array that needed to be constructed, sorted, traversed, and
discarded) turns out to have too many problems.  This reverts to a
hybrid solution that constructs an array for traversal, leaving the
linked list in its original order, but hides most of the details of
that from sortloot() callers.  The 'revamp' benefit of being able to
use normal list traversal is lost, as is the potential to skip
sorting when the list turns out to already be in the desired order.

This could stand to have a lot more testing than it's had so far.
2018-06-11 16:31:58 -04:00
PatR
7951557057 makeknown()
Noticed while investigating the report about sortloot interacting
with persistent inventory window when identifying all of invent and
possibly skipping some items.  [This doesn't fix that.]

End of game disclosure was using makeknown() on inventory.  It is a
jacket around discover_object() which passes the flag to exercise
Wisdom.  That's useless at end of game [now; conceivably wrong if
disclosure of characteristics exercise ever got added], so call
discover_object() directly to suppress exercise of Wisdom.

discover_object() was also calling update_inventory() for every item
being discovered.  That's not useful when looping through inventory
at end of game.
2018-06-11 16:31:36 -04:00
nhmall
15995375dd Guidebook date for merge verification 2018-05-28 08:45:35 -04:00
nhmall
959f0e557b Guidebook 2018-05-27 13:44:46 -04:00
PatR
1e0f546740 hilite_status string comparison
Simplify the string comparison done when checking 'textmatch' rules
to decide whether to highlight something.

Fix the menu titles when setting up a textmatch via 'O':  the title
for color referred to attribute and the one for attribute used the
default.  The two tiles are set up in advance; the one for color was
set correctly but then the one for attribute was written into the
wrong buffer.

When using 'O' to manipulate hilite_status rules, if there are any
when you're done and the 'statushilites' option (iflags.hilite_delta)
is 0, give a message reminding that it needs to be non-zero for
highlighting to be activated.
2018-05-22 02:42:08 -07:00
nhmall
f614b9e27e fix access violation in status_finish() if window port not initialized 2018-05-21 18:31:45 -04:00
nhmall
d95dae3cf4 fix early crash during config file error processing 2018-05-21 16:39:16 -04:00
nhmall
fcc26f2c44 fixes update for previous static prototype move in rip.c 2018-05-21 10:20:17 -04:00
nhmall
7508b0e34e Merge branch 'NetHack-3.6.2' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2 2018-05-21 09:55:44 -04:00
nhmall
6311985d57 don't highlight the leading space before gold field on the status line 2018-05-21 09:35:38 -04:00
PatR
dc00df935b hilite_status support for <=, >=, explicit =
Add threshold relationships <= and >= so that the change to make <
and > perform their expected comparison can be resolved.  "Point
release shouldn't force players to update their config files" does
not carry sufficient weight given that they already had to do that
to turn on status highlighting when going from 3.6.0 to 3.6.1.  The
3.6.2 release notes can warn them about the need to update their
status highlight options if they're currently using '<' and/or '>'.

Entering new hilite rules via the 'O' command accepted '=' prefix
for numbers, but rules from config files did not.  Now they do.
The '=' prefix is optional in both situations.

With 'O', percent rules and absolute rules had separate menu entries
so picking one was already choosing the rule type, but entering a
numeric value without percent sign (for percent) or with one (for
absolute) would change the type on the fly.  If someone has already
picked percentage they shouldn't be required to append '%' to the
digits, so that is now optional.  If explicitly included with the
number after having picked absolute, the value is rejected.  It is
trivial to back up in those menus and choose the alternate type if
someone changes his/her mind part way through.

If a status field has both persistent (percent, absolute, always)
and temporary highlights (up, down, changed), give the temporary one
precedence when the value has changed.  To do that with 3.6.1, the
rules for temporary had to follow the ones for persistent highlights
since whichever matched last was the one used.  Now their order
relative to each other doesn't matter.  If a value increases and
there is both an 'up' rule and a 'changed' rule, the more specific
'up' takes precedence, regardless of their relative order; likewise
for decreases and 'down' vs 'changed'.

There were a couple more tweaks needed to support negative values;
I overlooked the 'O' menu handling before.  >-1% and <101% now work
for both the config file and interactive adding via 'O' methods of
defining highlight rules, although new >=0% and <=100% will be
clearer to anyone examining a rule set.

'enum relationship' was forcing LT_VALUE to be -1 but that fact was
never utilized anywhere, and the code was using magic number -2 to
mean "no relationship yet".  This adds NO_LTEQGT to replace the
latter and gives it value -1.  EQ_VALUE is still 0 so effectively
the default if a highlight hasn't been fully set up yet.  LT_VALUE
is now just another positive value along with GT_VALUE, LE_VALUE, &c.

The Guidebook hasn't caught up with the code yet.

The rule choosing code used when deciding how to highlight something
only supports 'int' fields and relies on 'long' having the same bits.
It needs to be extended to support 'long' properly.  Fixing should
be straightforward (except maybe for the initialization of min/max
best fit handling) but this doesn't address that.  Also, data type
for encumbrance/carrying-capacity should be changed from unsigned to
plain int so that no extra handling for just one field will be needed.
2018-05-21 05:58:01 -07:00
nhmall
c58b6119ca be consistent with the tex version 2018-05-20 15:36:51 -04:00
nhmall
9cb9164ce5 update note of appreciation in Guidebooks (dat/history to follow) 2018-05-20 15:11:49 -04:00
PatR
b17c6d0b54 fix #H7155 - polearm can reveal hidden monster
The code to choose a likely target when applying a polearm was
basing its decision on visible spots which contained monsters,
so could expose the location of a hidden monster if there was
only one such spot within polearm range.  Not mentioned in the
report:  it also wouldn't pick remembered, unseen monster unless
there was a monster still at that spot.

I've changed it to choose candidate location based on the glyphs
shown rather than on the presence of monsters.
2018-05-19 15:46:09 -07:00
PatR
98099863ff fix #H7159 - orc hero can start with lembas wafers
Orc heroes get an extra food item ("to compensate for generally
inferior equipment") and it could randomly be lembas wafers (or
cram rations), and Ranger heroes always started with cram rations
even when they're orcs.  Fixing the latter was simple, but the
normal race-based substitutions weren't applied to randomly
generated items, so the fix for the former required a bit of code
reorganization in ini_inv().

Elf heroes already get lembas instead of cram; do the reverse for
dwarves (although I don't think this case can happen--no role gets
lembas wafers and only orcs and always-human tourists get random
food); give orc heroes tripe instead of either lembas or cram.
2018-05-19 11:47:15 -07:00
PatR
e9f1e03271 fix some of #H7156 - perm_invent issues
> [1. perm_invent is kept in flags so persists across save/restore, but
>  perm_invent capability can change if player restores with a different
>  interface--or same one running on a different-sized display--so it
>  ought to be in iflags instead.]

Not addressed here.

> 2. perm_invent window does not get updated when charging a wand (or
> other chargeable item presumably), with a scroll of charging.

Most scrolls rely on useup() -> update_inventory(), but charging uses up
the scroll early so that it will be gone from inventory when choosing an
item to charge.  It needed an explicit update_inventory() after charging.

> 3. update_inventory(), is called from setworn(), which is called from
> dorestore(), when loading a save.  Segfaults have been observed in
> variants based on this code (though not yet in vanilla 3.6.1), so it's
> possible this may be unsafe.  The update_inventory() call in setworn()
> could be protected with "if (!restoring) ..."

tty doesn't support perm_invent, so this might be a win32 issue.
I've made the suggested change, but a better fix would be to turn off
perm_invent as soon as options processing (new game) or options restore
(old game unless/until #1 gets changed) has finished setting things up,
then turn it back on at the end of moveloop()'s prolog when play is
about to start.

 = =

Most of the read.c change is reordering prototypes to match the order
of the corresponding functions.  I did this when adding a new static
routine, then ended up discarding that routine.
2018-05-19 04:19:18 -07:00
PatR
bed79b8391 more hilite_status threshold number parsing
In addition to leading '-' for negative values, accept explicit '+'
for positive values as a no-op.
2018-05-18 22:56:21 -07:00
PatR
546321d055 Unix Makefile changes 2018-05-18 22:04:21 -04:00
PatR
4b98266e25 fix #H7160 - hilite thresholds reject negatives
There was a prior report about this but I can't find it; maybe it
didn't go through the web contact form.  Anyway, status_hilite
threshold numeric values wouldn't accept a minus sign before the
digits, preventing negative AC values from being tracked.
2018-05-17 15:48:09 -07:00
nhmall
2758cd998a Guidebook.txt update 2018-05-17 03:42:38 +00:00
nhmall
1e60a16565 sync date between two Guidebook files (.mn, .tex) 2018-05-16 23:26:07 -04:00
nhmall
2b66b5ecd1 bump version ID values 2018-05-16 23:06:44 -04:00
nhmall
8dc2c59796 fixes36.2 catch-up for previous commit 2018-05-15 19:41:12 -04:00
nhmall
88f5dcbfb4 fix spaces in hilite_status option text field not working H7107 (GitHub #88)
Fixes #88

H7107: FWD: spaces in hilite_status option text field not working
2018-05-15 19:35:36 -04:00
nhmall
504f0a4510 integrate aklys feature introduced in 3.6.1 into 3.6.x display 2018-05-15 06:41:06 -04:00
nhmall
aaddab5450 catch up on fixes36.2 updates 2018-05-15 01:10:32 -04:00
nhmall
2e8b69d5ff some tty per field rendering and optimization 2018-05-14 21:13:37 -04:00
nhmall
4e5c41401f last line of config file wasn't heeded if newline was missing 2018-04-28 17:22:21 -04:00
nhmall
331abfe530 Specify both width and height when creating font for width testing
From Bart...

When we are creating the console font for testing character widths,
we were not specifying width. Because of this, the created font's
average width might be larger then what we expect and we might
falsely detect that the font was inappropriate for playing Nethack.
Fix provides the width that we are expecting when creating the font.
2018-04-28 12:11:19 -04:00
PatR
78fe5fbb05 display glitch: warning vs remembered,unseen
Noticed while testing the fix for the recently reported clairvoyance
bug.  I saw a '1' move onto an 'I', then when it moved again the 'I'
reappeared.  The remembered unseen monster couldn't be there anymore
if the warned-of monster was able to walk through that spot, so
remove any 'I' when showing a warning (digit) to stop remembering an
unseen monster at the warning spot.

Nobody has ever reported this so fixing it isn't urgent, but fixing
it is trivial so I'm doing it in now (without the clairvoyance fix).
2018-04-26 15:07:00 -07:00
nhmall
dcb9657b03 new Guidebook.txt 2018-04-25 19:56:39 -04:00
nhmall
9914250632 Guidebook.tex bit spotted in test pdf generation 2018-04-25 17:36:29 -04:00
nhmall
5101b9efb8 Update some dates and comment out BETA 2018-04-25 17:11:28 -04:00
nhmall
671c40c557 Merge branch 'NetHack-3.6.0' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.0 2018-04-25 16:58:59 -04:00
nhmall
fd482d11f0 fixes36.1 multi-line entries require leading tab after first line 2018-04-25 16:55:42 -04:00
keni
0f58af6f37 add missing copyright info 2018-04-25 16:54:50 -04:00
keni
11f1983253 update .gitattributes files for substitution and copyright headers 2018-04-25 14:52:43 -04:00
nhmall
6623b5b007 Update Guidebook.txt 2018-04-23 21:38:36 -04:00
nhmall
f6496a61f1 Apr23 Guidebook date bump 2018-04-23 21:31:28 -04:00
PatR
79c49eb86d Guidebook...
Refine the recently added short description about how monsters are
displayed on the map.
2018-04-23 16:08:57 -07:00