PatR [Sat, 11 May 2019 10:04:53 +0000 (03:04 -0700)]
fix #H8712 - curses menu selector overflow
The curses interface would assign menu selector characters a-z, A-Z,
and then 0-9, but trying to type 0-9 would start a count rather than
select an entry, and if the display was tall enough for more than 62
entries, the ones after '9' were ASCII punctuation characters.
Limit the number of entries per page to 52 + number_of_'$'_entries
(which should be 0 or 1) so that it won't run out of normal letters.
The perm_invent window, if enabled, ought to allow more than that
because it isn't used to make selections and might have an arbtirary
number of '#' overflow entries. But I'll leave that for somebody
else to tackle.
Tested by temporarily setting the limit to 26 instead of 52 since
I'm not able to display anything tall enough to exercise the latter.
PatR [Fri, 10 May 2019 22:21:59 +0000 (15:21 -0700)]
place_object vs multiple boulders
When place_object() puts a non-boulder underneath a boulder, make it
put the non-boulder under all the boulders there rather than just under
the topmost one. Otherwise the map display will show the non-boulder
rather than the 2nd boulder if the top boulder gets moved away by some
means other than pushing. (Pushing explicitly brings lower boulder to
top of pile in order to try to push it next.)
Reproduce by: wish for boulder--it will drop. Drop something else--
the something-else will end up under the boulder. Repeat. The second
boulder will be on top but the second something-else will be next in
the pile, above the first boulder. Now polymorph into a giant and pick
up the first boulder, then move away from that spot. Map will show
second something-else instead of the remaining boulder.
This fairly simple fix should work reliably on new games since boulders
will end up being consecutive on the top of piles. For old games,
boulders after the topmost could be anywhere and still yield a display
glitch, but since that's all the problem is (I hope...), we ought to
be able to live with that until old games eventually go away.
[A map display glitch doesn't explain a corrupted 'uball' so this fix
doesn't solve that.]
PatR [Fri, 10 May 2019 00:15:14 +0000 (17:15 -0700)]
fixes36.2 update for posterity
Change of couple entries which describe fixed bugs to use past tense
instead of present tense. Fix a typo or two and a couple of instances
of clumsy wording. Move a dead-fake-hero-on-trap entry from normal
fixes section to exposed-by-git section since it was a post-3.6.1 bug.
Move two VMS entries from exposed-by-git section to interface-specific
section where they were intended.
I didn't make it through the whole file so there may be more room for
improvement. It's too late for 3.6.2 but the copy of doc/fixes36.2 in
later versions will be 'better'.
PatR [Sun, 5 May 2019 21:48:43 +0000 (14:48 -0700)]
bones bit: crysknife vs green slime
Being turned into green slime never drops hero's inventory so invent
objects shouldn't be subject to obj_not_held() handling.
obj_not_held() does apply to undead. Arising as a mummy or vampire
doesn't go through the trouble of dropping everything and picking it
back up, but there is a point in the die...arise sequence where the
hero is implicitly a corpse so nobody is holding his/her stuff.
PatR [Sun, 5 May 2019 20:33:30 +0000 (13:33 -0700)]
ball&chain sanity checking
Add a bc sanity check. It seems to work ok--in other words, not
trigger--under normal punishment. I don't have any test cases to
exercise its warnings.
This dragged in a couple of minor bc changes that were pending. I
should have cleared those out before tackling the sanity checking.
Pasi Kallinen [Sun, 5 May 2019 19:49:21 +0000 (22:49 +0300)]
Fix monster trapped state being wrong
When cloning a monster, clear the clone trapped and hiding states.
When splitting a monster (eg. a black pudding), the clone could
be placed on a trap, so do mintrap.
When removing a monster from the map, clear the trapped state.
The change to fix setting SEDUCE=0 in sysconf broke chatting with
seductive demons by unintentionally changing the way Null attack
argument was handled. It's still handled differently than it used
to be, but I think this difference is correct.
Qt5 gave "status 'reassess' before init" panic at start of new game.
Don't call status_initialize(REASSESS) from set_usamon()--used for
hero setup as well as for hero polymorph--unless it was previously
called from display_gamewindows() with !REASSESS [which happens when
windowprocs.wincap2 has WC2_STATUS_HILITES or WC2_FLUSH_STATUS set].
If a poly'd hero spits venom and it lands at a 'soft' spot such as
water, it would remain as an intact venom object. (Venom spat by
monsters seems to always be used up regardless of where it lands.)
Vlad keeps his own form when carrying the Candelabrum, but if you
manage to get that away from him he should behave like other vampires.
He wasn't though; a high level wizard casting polymorph on him would
change him into an arbitrary monster rather than into a wolf/bat/cloud
that revives as Vlad when killed.
|The seemingly dead vampire bat rises as a vampire.
was overriding hallucination when describing both old and new forms.
In 3.6.0 it only overrode the dying shape (explicitly so, presumeably
because the feature was brand new) and honored hallucination for the
revived shape. The 3.6.1 fix to prevent non-hallucinating: 'The
seemingly dead Foo rises as Foo.' for a named vampire unintentionally
overrode hallucination for the revived shape.
Change it to honor hallucination for both before and after monsters
|The seemingly dead grid bug rises as a microscopic space fleet.
Preserve temporary fake object's previous dknown value by storing it
as a flag value within the m_ap_type field of the posing monster, and
recalling it when it is needed.
This is intended to help eliminate observable differences in price display
between real objects and mimics posing as objects.
98% of this is just switching the code to utilize macro M_AP_TYPE(mon)
everywhere to ensure that the flag bits are stripped off when needed.
Noticed while looking over mimic hiding. When on an object, a mimic
will hide as that type of object. But for a corpse, it picked a random
monster type and could choose one that doesn't leave a corpse. Also as
a tin it would always be an empty one, but there doesn't seem to be any
way for a player to learn that.
Noticed while trying to find the reason for the wildmiss impossible(),
you could be teleported and then drop dead at the destination. A QM's
AD_TLPT hit also does 1d4 physical damage which gets applied after the
teleport. Getting "You die." seemed pretty strange, particularly after
picking the destination with telport control. This makes sure that the
damage will never be fatal when teleport is attempted.
Some port of yacc was generating '#include <stdlib.h>' before our
'#include "config.h" and needed a specific define from config1.h to
be supplied on the command line to avoid conflicting contents within
that header file, but then config1.h drew complaints about redefining
the macro. Guard against that.
DEC C in one of its non-ANSI modes didn't like
fieldorder = test ? &array1 : &array2;
It first complained that '&' applied to an array has no effect (which
was typically true in pre-ANSI environments) and once those '&'s are
ignored, the attempted assignment didn't match the variable's type.
That code was actually more complicated that it needed to be; slightly
simpler code works as intended.
Showing the price of a shop object when examining it with '/' or ';'
didn't include a price if it was actually a mimic. This makes fake
objects have prices when appropriate, but it is only a partial fix
because moving away from a mimic causes nethack to forget the fake
object's dknown flag for most types of objects.
That could be solved by adding an mobj field to mon->mextra, which
will break save compatibility, or by adding a whole extra set of
object glyphs for object-with-dknown-set. The latter could probably
be done without breaking backwards save compatibility (new program
using old files) but it seems like more effort that it'd be worth and
it would break forwards save compatibility (old program attempting to
use new files--something we've never claimed to support).
Also, DEC C in 'common' mode complains about indented '#' starting a
line but not in column 1. Putting #pragma in column 2 was deliberate
in case of an ancient compiler which doesn't understand that directive.
Splitting the difference via non-indented '# pragma' may or may not
mollify the latter when it's bypassing conditionally excluded code.
During shop repair, give a message about the shopkeeper using a spell
(if hero is close enough) before "Suddenly, <various repairs occur>."
And when shop repair is for a single untrap of landmine or bear trap
adjacent to shk (and the hero can see it happen), say "<Shk> untraps
<trap>" rather than just "Suddenly, a trap is removed from the floor!"
For the inventory of a probed monster, if the probing took place in
a shop the inventory display would have selling price appended to
all the items. That wouldn't really be a problem if it was just for
a pet who was carrying one shop item, but it applied to every item
being carried by any probed monster (including shopkeeper) with no
regard for whether the shop actually claimed ownership.
[I accidentally left this out of the earlier patch.]
Change in meaning of mnearto()'s return value wasn't progagated to
shkcatch(). Make it an int instead of boolean so that it can
communicate both 'moved successfully' and 'moved but had to move
another monster out of the way to do so'.
Change in meaning of mnearto()'s return value wasn't progagated to
shkcatch(). Make it an int instead of boolean so that it can
communicate both 'moved successfully' and 'moved but had to move
another monster out of the way to do so'.
Tweak the status hilites section. Add a bit of detail about how to
specify both color and attribute and/or multiple attributes. Also,
change the Guidebook's table of status fields to be column-oriented.
With the exception of 'score', reading down the three columns now
matches going across the status lines. The previous ordering started
row-oriented but then became scrambled compared to the usual display.
Enable blink and dim for the TERMLIB + !NO_TERMS configuration of the
tty interface. Blink now works the same as in the curses interface
for status highlights. The terminal emulator I'm using has an escape
sequence for dim but it evidently doesn't do anything (same no effect
as with curses), so that isn't adequately tested.
The curses interface wouldn't build with HILITE_STATUS disabled. I
started adapting it to handle genl_status_update() but that was taking
too much effort with each niggling detail leading to another. This
goes the opposite direction: forcing the old STATUS_VIA_WINDOWPORT
behavior without having that #define available. That dragged along a
bunch of unexpected changes too.
mon_arrive() -> m_into_limbo() -> migrate_to_level() -> wormgone()
followed by place_monster() "for relmon". relmon() was changed (last
November, cc5bb44a9a757fe00800c90cb3a648b009af155d) to not require
the monster be on the map, so just get rid of the place_monster() that
was trying to put the "gone" long worm at <0,0>.
Also, another m_into_limbo() bit: make mdrop_special_objs() check the
location and send any dropped items to random locations if the monster
dropping things isn't on the map, instead of placing them at <0,0>.
Take care of a minor 'TODO' and make another stab at getting truncated
encumbrance and/or level-description to reset to full size when enough
space becomes available.
Put the prototypes for routines in botl.c into the same order as the
corresponding functions are in the file. Also a few were missing and
another few used STATIC_OVL when STATIC_DCL was appropriate.
I've noticed many instances of the game pausing and not being sure why,
then pressing <space> and having it resume. The curses interface had
a tendency to put its equivalent of the --More-- prompt, >>, somewhere
where that wasn't visible, either off the right hand edge (possibly) or
underneath the window borders if those were enabled. Especially the
very last one it issues prior to exit. (An extra one compared to tty
behavior.)
This ended up being a pretty substantial overhaul of message window
handling. I wouldn't be surprised if it has off-by-one errors which
happen to be paired up and cancel each other out. ">>" is still drawn
in orange if guicolor is on, now in inverse video when that is off.
If it happens to be drawn at the same screen location in consecutive
instances, the first ">" will toggle between blink and not blink so
that there'll be no doubt as to whether the keypress registered when
dismissing it (moot if the text preceding it is different but there's
no attempt to be smart enough to check that, just screen placement).
Make the same fix to curses that was done for tty in 3.6.1: don't
let MSGTYPE entries be matched against prompt strings. Like tty,
curses was using ordinary pline() to issue prompts; something like
MSGTYPE=hide"yn"
could wreak havoc. Switch to custompline(OVERRIDE_MSGTYPE,...).
This changes the recently added msg_window:f for curses to start
viewing the old messages on the last page rather than the first. For
msg_window:Reversed (the default for curses) and for either direction
when all of the message history happens to fit on one page, there's
no change. But for multiple pages, the FIFO feedback now pads the top
of the first page with blank lines so that the last page is full, and
it starts out showing that last page first. So if you only want to go
back few or several messages, they will be in view immediately.
Old layout:
|first message (oldest) | |1st message of last page |
|2nd message of 1st page | | ... |
| ... | |final (most recent) mesg |
| ... | | (blank filler) |
|last message of 1st page | | (blank filler) |
| (1 of 2) => | | <= (2 of 2) |
and ^P started with first page visible and needed normal menu handling,
<space> or '>' or '|', to go forward to view the most recent messages.
New layout:
|1st message of last page | | (blank filler) |
|2nd message of last page | | (blank filler) |
| ... | |first message (oldest) |
| ... | | ... |
|final (most recent) | |last message of 1st page |
| <= (2 of 2) | | (1 of 2) => |
and ^P starts on last page (two of two in this example) but can go
back with '<' and '^'.
So if the total size takes one and third pages (which isn't uncommon
for the default number of kept messages), you'll see 3/4 of the most
recent messages on the initial screen, then you can page backward if
you want to see the other 1/4.
The page indicator is deliberately drawn a bit differently just to
draw attention to the fact you're starting on the last page. I'm not
sure whether that is actually worthwhile but it was trivial to do.
I didn't noticed this because I've been building for tty+curses+X11
and either of the first two cause iflags.extmenu to exist. Make it
unconditional; there's not much benefit from trying to suppress it
for configurations that don't need it.
Support for scrolling within menus via first-/previous-/next-/last-
page keystrokes ("^<>|" by default) was added to X11's general menu
handling but the extended commands menu uses a special menu rather
than a general one. This clones the relevant code to add support for
those keys to extended commands.
The expansion of the extended commands list to include every command
has made picking extended commands out of X11's menu become tedious.
This uses the existing 'extmenu' option (previously tty-only) to
control whether all the commands are present or just the traditional
subset not bound to non-meta keystrokes ('adjust', 'chat', 'loot', &c).
PatR [Sun, 31 Mar 2019 22:34:46 +0000 (15:34 -0700)]
curses message suppression
The curses interface was using 'moves' as if it meant "moves" rather
than "turns". Typing ESC at >> (curses' terser version of --More--)
prompt would suppress messages for the rest of the current turn rather
than just the rest of the current move. So if the hero got an extra
move due to being Fast, there would be no feedback during that move.
PatR [Sun, 31 Mar 2019 15:23:36 +0000 (08:23 -0700)]
streamlined status update for 'time'
When the 'time' option is on and context.botl isn't already set,
call a simpler status update routine that ignores all other fields.
When that flag is already set, full status update takes care of time
along with the other fields.
Expected to reduce bottom lines processing time but not screen I/O.
Only lightly tested.
PatR [Sun, 31 Mar 2019 14:04:23 +0000 (07:04 -0700)]
curses status highlighting
window.doc states that the colormasks argument to status_update() is
only relevant for BL_CONDITION, but curses was relying on it to be
passed for BL_FLUSH as well. Yesterday's changes stopped the latter
and broke highlighting of status conditions. Other interfaces appear
to honor the description in window.doc.
PatR [Sun, 31 Mar 2019 07:33:33 +0000 (00:33 -0700)]
bogus status updates
I finally figured out why status gets updated periodically even if
none of the fields have changed. Once a temporary highlight times
out, it starts a cycle of timeouts every 'statushilites' turns. When
I worked on this before, it was convoluted but not this convoluted.
In moveloop, if 'context.botl' call bot; in bot
call evaluate_and_notify_windowport;
for each field, call evaluate_and_notify_windowport_field:
call hilite_reset_needed and set 'reset' to the result;
if 'reset' is True then do status_update
and set 'curr->chg' and 'prev->chg' to True.
Then in moveloop call status_eval_next_unhilite:
for each field
if 'curr->chg' set 'curr->time' to moves+hilite_delta;
on the call after hilite_delta ('statushilites') moves,
call hilite_reset_needed which returns True if there is any
rule for temporary highlight and set 'context.botl'.
Go back to start. If multiple fields had temporary timeouts and
they were activated on different turns so expired on different turns
you could conceivably end up with context.botl being set every turn.
My first writeup trying to explain all this was wrong. I won't
testify about the accuracy of this one in court....
This extends the highlighting data structure to track the current
rule that's in use. And for that to make sense, it eliminates the
merging of settings from multiple matching rules. So anybody with
hit-points/up/inverse
hit-points/up/green
hit-points/up/bold
will need to manually merge their rules like
hit-points/up/green&inverse+bold
or else whichever rule matches last will be the only one in effect.
There are a lot of miscellaneous changes made as I flailed about.
The three most significant ones are that there is no guesswork over
what kind of highlight rule is in effect, status_eval_next_unhilite
will only set a timeout value if the current rule is for a temporary
highlight, and hilite_reset_needed will only return True if a timeout
is for a temporary highlight (probably moot after the _next_unhilite
change).
PatR [Sun, 31 Mar 2019 00:46:16 +0000 (17:46 -0700)]
status line title field
Status formatting used to truncate the Name portion of "Name the Rank"
or "Name the Monster-type" at 10 characters even if the rank or monster
portion left room for more. Change that to keep as much of the name as
will fit. The truncation might vary over time as new experience levels
produce new rank titles of differing lengths, but I don't think that's
a problem. For truncated names, it still keeps at least 10 characters
even if that leaves the field longer than the target length for title
(which used to be 29 but now is 30).