]> granicus.if.org Git - nethack/log
nethack
5 years agofix #H9164 - menu colors for curses perm_invent
PatR [Sat, 31 Aug 2019 17:46:35 +0000 (10:46 -0700)]
fix #H9164 - menu colors for curses perm_invent

Commit e3af33c9db313d288f6b86a35b8ee705376aebfb in June changed
curses handling for perm_invent to strip off doname()'s "a ", "an ",
or "the " prefix in order to shorten inventory entries and get a
couple of significant extra characters before end-of-line truncation.
That had an unintended impact on menu colors pattern matching for
patterns which expected the article prefix.  Do the matching before
stripping off the prefix instead of after so that the matching gives
the same results as when used on a normal inventory menu (even though
this means that from the user's perspective most perm_invent entries
will have invisible text at the start).

Also for menu colors, don't require curses-specific 'guicolor' option
be enabled when the general, more-specific 'menucolors' option exists
to control menu coloring.  (curses was requiring that both be True.)

5 years ago'O' vs perm_invent (mostly)
PatR [Sat, 31 Aug 2019 08:38:19 +0000 (01:38 -0700)]
'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....

5 years agofix #H9164 - crash during restore when swallowed
PatR [Sat, 31 Aug 2019 01:11:43 +0000 (18:11 -0700)]
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.

5 years agosys/unix/hints/*: mkfontdir and cp -n
PatR [Wed, 21 Aug 2019 00:16:57 +0000 (17:16 -0700)]
sys/unix/hints/*: mkfontdir and cp -n

Change all the POSTINSTALL 'mkfontdir' to 'mkfontdir -x .lev' although
the mkfontdir version on my system didn't think $(HACKDIR)/*.lev were
font files when I built without dlb.

Also change the PREINSTALL 'cp -n win/X11/nethack.rc ~/.nethackrc' to
keep going if it fails.  The linux hints use 'cp -n' for sysconf but
since it is doing so for the playground directory and 'make install'
starts out by clearing away everything in that directory, it shouldn't
fail.  But some extra bullet proofing there may be warranted.  Only
the initial cp is protected against clobbering an existing file; the
ownership+permission fixups that are applied to the copy of original
file still get applied to an existing one.

5 years agoquite some Xcode warnings
nhmall [Sat, 17 Aug 2019 16:55:48 +0000 (12:55 -0400)]
quite some Xcode warnings

5 years agocopy-paste error bit
nhmall [Sat, 17 Aug 2019 01:47:37 +0000 (21:47 -0400)]
copy-paste error bit

5 years agotravis build update and mkfontdir argument for linux
nhmall [Fri, 16 Aug 2019 17:50:41 +0000 (13:50 -0400)]
travis build update and mkfontdir argument for linux

travis recently changed linux default dist from trusty to xenial, and bionic is next

include an additional travis linux build under bionic to eliminate surprises there

add a parameter to mkfontdir under linux to prevent it form going after .lev files

5 years agoadd X11 packages to couple of travis builds
nhmall [Fri, 16 Aug 2019 00:41:50 +0000 (20:41 -0400)]
add X11 packages to couple of travis builds

5 years agofix #H9118 - stoning a sandestin
PatR [Thu, 15 Aug 2019 01:49:16 +0000 (18:49 -0700)]
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.

5 years agofix #H9117 - bookeeping for fatal status condition
PatR [Mon, 12 Aug 2019 01:56:43 +0000 (18:56 -0700)]
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.

5 years agofix github issue #211 - wrong parentheses
PatR [Thu, 8 Aug 2019 18:25:36 +0000 (11:25 -0700)]
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.

5 years agofix github issue #209 - typo in end_of_input()
PatR [Thu, 8 Aug 2019 18:01:56 +0000 (11:01 -0700)]
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.

5 years agofix #H9100 - typo in Mort #4
PatR [Tue, 6 Aug 2019 11:24:21 +0000 (04:24 -0700)]
fix #H9100 - typo in Mort #4

For "They look at you but the don't see you", "the" should be a second
"they".  Simple transcription typo rather than a mistake in the book.

5 years agofix #H9084 - teleported boulder left stale screen
PatR [Fri, 2 Aug 2019 18:51:26 +0000 (11:51 -0700)]
fix #H9084 - teleported boulder left stale screen

Report was for Sokoban but it applied anywhere:  if a teleported
boulder landed in a pit or trap door or hole and flooreffects() used
it up (so returned True), rloco() didn't update the location it was
teleported from and it appeared not to have moved.  (Line of sight was
updated to reflect its absence but map spot wasn't redrawn without it.)

5 years agofix #H9082 - post-3.6.2 monster throwing crash
PatR [Fri, 2 Aug 2019 17:42:26 +0000 (10:42 -0700)]
fix #H9082 - post-3.6.2 monster throwing crash

Changing
  if (ammo_and_launcher(otmp, uwep) && mwep->otyp == ELVEN_BOW)
(with 'uwep' typo) to
  if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep))
(with fixed 'mwep') moved ammo_and_launcher()'s hidden non-null
test to after 'mwep->otyp'.  If mwep was Null (so monster must be
throwing non-ammo such as darts or daggers rather than shooting
with a launcher), a crash occurred.  (Throwing such things while
the monster is wielding any weapon doesn't have this problem.)

I don't think 3.6.2 can crash here.  If hero's uwep is a bow, otmp
must be arrows to get past pre-3.6.3's incorrect ammo_and_launcher()
check.  And a monster won't shoot arrows unless wielding a bow, so
monster's mwep would be non-Null regardless of what uwep is.

I tested a kobold with darts and an elven bow.  But I also gave it
one elven arrow to provoke it into wielding the bow and my test
didn't throw darts with nothing wielded....

5 years agobad weapon check for monster multi-shot shooting
PatR [Wed, 31 Jul 2019 21:22:09 +0000 (14:22 -0700)]
bad weapon check for monster multi-shot shooting

A typo caused the bow and arrow check when a monster was wielding an
elven box to test the hero's weapon with monster's ammo.  [I looked
at the old slash'em code where I think this came from and it doesn't
have the typo but does have a different bug.  A monster could get a
multi-shot volley by wielding an elven bow when throwing darts or
spears.  The extra bow and arrow check is intended to prevent that.
The typo was probably by me but I have no memory of that code....]

Elves with bows (or other monsters who manage to pick up and wield an
elven bow) will shoot bigger volleys after this fix.  That will make
them more dangerous but also cause them to run out of arrows more
quickly.

5 years agoGlory of Arioch vs spellbook
PatR [Wed, 31 Jul 2019 00:24:33 +0000 (17:24 -0700)]
Glory of Arioch vs spellbook

From the newsgroup (reported for slash'em but applies to nethack too):
a chaotic monk was crowned and told he or she had been "chosen to
steal souls for My Glory!" while being given a spellbook of restore
ability which has nothing whatever to do with soul stealing.  There's
alternate wording for when Stormbringer can't be given because it
already exists; also use that for when it's not going to be given
because the character is discouraged against wielding weapons.

5 years agoMjollnir comment in artilist[]
PatR [Sun, 28 Jul 2019 22:06:02 +0000 (15:06 -0700)]
Mjollnir comment in artilist[]

The description of Mjollnir's behavior when thrown was incomplete and
slightly inaccurate.

5 years agotimer validations
PatR [Sat, 27 Jul 2019 23:12:24 +0000 (16:12 -0700)]
timer validations

Add the contributed code that checks for attempting to start a
duplicate timer.  It's based on a comment which must have been there
at least 25 years and doesn't solve any known problems, but it is
conceptually similar to the large amount of sanity checking which has
gone into 3.6.x.

It didn't work as is because it was comparing two unions with '=='.
I don't know offhand whether C++ supports that but C doesn't (through
C11 at least; don't know about C17).  The union ('anything') is simple
enough that two instances can be compared without jumping through hoops.

I've also added another check for timer 'kind' (level, object, monster,
or global).

5 years agoRevert "When fuzzing, use the number of moves as a proxy for the hour."
Bart House [Mon, 15 Jul 2019 04:29:41 +0000 (21:29 -0700)]
Revert "When fuzzing, use the number of moves as a proxy for the hour."

This reverts commit f75deae0bcca5bdd4afddb40291e5e2bb0ecd846.

5 years agoRevert "Added experimental feature NEW_KEYBOARD_HIT."
Bart House [Mon, 15 Jul 2019 04:28:55 +0000 (21:28 -0700)]
Revert "Added experimental feature NEW_KEYBOARD_HIT."

This reverts commit bc65112ce07c6e2056ed28b5e93954679fb36acd.

5 years agoRevert "Improved readability of topline state management."
Bart House [Mon, 15 Jul 2019 04:28:40 +0000 (21:28 -0700)]
Revert "Improved readability of topline state management."

This reverts commit 08a19108678e772ab52ee195be74101b2792accb.

5 years agoRevert "Moved declaration of topline state to wintty.h."
Bart House [Mon, 15 Jul 2019 04:28:03 +0000 (21:28 -0700)]
Revert "Moved declaration of topline state to wintty.h."

This reverts commit 7bb41c797fb2491dc39102ddd4f1d31bd74c10c8.

5 years agoRevert "Remove the remapping of snprintf to _snprintf when compiling with MSC."
Bart House [Mon, 15 Jul 2019 04:18:03 +0000 (21:18 -0700)]
Revert "Remove the remapping of snprintf to _snprintf when compiling with MSC."

This reverts commit 9801635f56804a195c2b1f5c6bec0e239c9c4935.

5 years agoRevert "Modified nhassert_failed to call impossoible."
Bart House [Mon, 15 Jul 2019 04:17:39 +0000 (21:17 -0700)]
Revert "Modified nhassert_failed to call impossoible."

This reverts commit 3e4a0759a37ec6fe62d026cdd02dadd0ec6f682d.

5 years agoRevert "Fixed bug with inmore and toplin state management."
Bart House [Mon, 15 Jul 2019 04:17:19 +0000 (21:17 -0700)]
Revert "Fixed bug with inmore and toplin state management."

This reverts commit 0f57f0e48ca6e6823fb238566d5faddd3cf0726b.

5 years agoRevert "Added assertions to check toplin state."
Bart House [Mon, 15 Jul 2019 04:16:59 +0000 (21:16 -0700)]
Revert "Added assertions to check toplin state."

This reverts commit 1db45c8016484114841f39ffe70c8d9cdd1ad92c.

5 years agoRevert "Comment out nhassert() calls."
Bart House [Mon, 15 Jul 2019 04:16:27 +0000 (21:16 -0700)]
Revert "Comment out nhassert() calls."

This reverts commit 45a9c5eb14326521188457fe87a9d853b44a64ce.

5 years agoRevert "Added nhassert to core."
Bart House [Mon, 15 Jul 2019 04:15:54 +0000 (21:15 -0700)]
Revert "Added nhassert to core."

This reverts commit 0ca299acb3b52c90e65ad3ca3eb69ccfa8cceb97.

5 years agoRevert "Fixed sign/unsigned comparisions."
Bart House [Mon, 15 Jul 2019 04:15:31 +0000 (21:15 -0700)]
Revert "Fixed sign/unsigned comparisions."

This reverts commit 0e8e5aac93e660a001dccb66df7320023aaa36de.

5 years agoRevert "Tweaks to nhassert implementation. Change to warnings on MSC build."
Bart House [Mon, 15 Jul 2019 04:15:01 +0000 (21:15 -0700)]
Revert "Tweaks to nhassert implementation.  Change to warnings on MSC build."

This reverts commit 2f3da35c6893d2a44e8281ae209f00d54eefa2f2.

5 years agoRevert "Fix compiler warnings."
Bart House [Mon, 15 Jul 2019 04:13:43 +0000 (21:13 -0700)]
Revert "Fix compiler warnings."

This reverts commit 90f5aa91b794ad333fc04693677d0a7a9d8ca18e.

5 years agoRevert "Removing assertion that does not hold under all scenarios."
Bart House [Mon, 15 Jul 2019 04:13:18 +0000 (21:13 -0700)]
Revert "Removing assertion that does not hold under all scenarios."

This reverts commit c44ad5645d90267e7ed1d1a6c57acc1437dca10e.

5 years agoRevert "Adding ptr_array data structure."
Bart House [Mon, 15 Jul 2019 04:12:59 +0000 (21:12 -0700)]
Revert "Adding ptr_array data structure."

This reverts commit e665d3b85024e3a7580e80888a70b47d5ae9384c.

5 years agoRevert "Re-worked tty_putmsgistory and tty_getmsghistory."
Bart House [Mon, 15 Jul 2019 04:12:21 +0000 (21:12 -0700)]
Revert "Re-worked tty_putmsgistory and tty_getmsghistory."

This reverts commit 1d0b8b4680512a85a045006b3adf7fe65100f1bd.

5 years agoRevert "Add stopping in the debugger when nhassert() is hit in the windows port."
Bart House [Mon, 15 Jul 2019 04:11:41 +0000 (21:11 -0700)]
Revert "Add stopping in the debugger when nhassert() is hit in the windows port."

This reverts commit 5d2872dd4f24fb76f29bf34f6f950394910d6d33.

5 years agoRevert "Removed the older version of tty_putmsghistory and tty_getmsghistory."
Bart House [Mon, 15 Jul 2019 04:10:51 +0000 (21:10 -0700)]
Revert "Removed the older version of tty_putmsghistory and tty_getmsghistory."

This reverts commit aa95e20ca7cbb2a90f8076f04410886c0733dc74.

5 years agoRevert "Fuzzer improvements."
Bart House [Mon, 15 Jul 2019 04:10:39 +0000 (21:10 -0700)]
Revert "Fuzzer improvements."

This reverts commit 435f1c46267a194e44f0b75c7348be5a900d8ede.

5 years agoRevert "Fix build issue on linux."
Bart House [Mon, 15 Jul 2019 04:10:27 +0000 (21:10 -0700)]
Revert "Fix build issue on linux."

This reverts commit d33160d069c00e26de902e48c2bfda2de2eeeb3d.

5 years agoRevert "Tweaks to fuzzer scripts."
Bart House [Mon, 15 Jul 2019 04:10:07 +0000 (21:10 -0700)]
Revert "Tweaks to fuzzer scripts."

This reverts commit cd375064ddbf70770a934820e37b796c4623a145.

5 years agoRevert "Revert type change of lit which would break code."
Bart House [Mon, 15 Jul 2019 04:09:38 +0000 (21:09 -0700)]
Revert "Revert type change of lit which would break code."

This reverts commit cc1219b5a8bae222a6ba6a0c755419c9ca200a79.

5 years agoRevert "Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c"
Bart House [Mon, 15 Jul 2019 04:09:29 +0000 (21:09 -0700)]
Revert "Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c"

This reverts commit d9da488c35de801fd651c3dd0ee8f152d5309337.

5 years agoRevert "Remove dead code."
Bart House [Mon, 15 Jul 2019 04:09:16 +0000 (21:09 -0700)]
Revert "Remove dead code."

This reverts commit 5428d73287d3e808f4480b04dc9733165dd32e83.

5 years agoRevert "Fix typo in formatting string."
Bart House [Mon, 15 Jul 2019 04:09:07 +0000 (21:09 -0700)]
Revert "Fix typo in formatting string."

This reverts commit fa5c499268f4f6b687a25a3004c47e5f5dc0a546.

5 years agoFix typo in formatting string.
Bart House [Sun, 14 Jul 2019 21:31:30 +0000 (14:31 -0700)]
Fix typo in formatting string.

5 years agoRemove dead code.
Bart House [Sun, 14 Jul 2019 21:31:00 +0000 (14:31 -0700)]
Remove dead code.

5 years agoMove fuzzer_start, fuzzer_stop and fuzzer_log to pline.c
Bart House [Sun, 14 Jul 2019 21:30:38 +0000 (14:30 -0700)]
Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c

5 years agoRevert type change of lit which would break code.
Bart House [Sun, 14 Jul 2019 21:02:05 +0000 (14:02 -0700)]
Revert type change of lit which would break code.

Cast lit (which will be 1) to unsigned int to remove warning.

5 years agoTweaks to fuzzer scripts.
Bart House [Sun, 14 Jul 2019 19:13:19 +0000 (12:13 -0700)]
Tweaks to fuzzer scripts.

5 years agoFix build issue on linux.
Bart House [Sun, 14 Jul 2019 09:00:21 +0000 (02:00 -0700)]
Fix build issue on linux.

5 years agoFuzzer improvements.
Bart House [Sun, 14 Jul 2019 07:20:09 +0000 (00:20 -0700)]
Fuzzer improvements.

phase_of_moon and friday_13th determined using rn2() instead of local
time if fuzzing.  Don't reseed using init_random() if fuzzing.  Allow
set_random to be called outside of hacklib.  rn2_on_display_rng uses
rn2 if fuzzing so that we have a single source of random that we can
ensure is reproducible.  Implement rul() that returns a random unsigned
long.  Fix bug in fuzzer handling of ntposkey which would cause us to use
unitialized values for x and y.  Added command line arguments to allow
auto starting and stopping of fuzzer.  Add a logging facility for the
fuzzer to use to record activity.  Added some scripts used to automate
fuzzer testing on windows.

5 years agoRemoved the older version of tty_putmsghistory and tty_getmsghistory.
Bart House [Sat, 13 Jul 2019 23:23:37 +0000 (16:23 -0700)]
Removed the older version of tty_putmsghistory and tty_getmsghistory.

5 years agoAdd stopping in the debugger when nhassert() is hit in the windows port.
Bart House [Sat, 13 Jul 2019 23:00:14 +0000 (16:00 -0700)]
Add stopping in the debugger when nhassert() is hit in the windows port.

When stopping in the debugger after having called impossible, the windowing
state will have been modified since the assertion was hit.  This made
examining state that caused the nhassert to fire no longer possible.
To avoid this issue, we now detect the debugger and stop in the debugger
prior to impossible.

5 years agoRe-worked tty_putmsgistory and tty_getmsghistory.
Bart House [Sat, 13 Jul 2019 22:57:06 +0000 (15:57 -0700)]
Re-worked tty_putmsgistory and tty_getmsghistory.

When we were saving message history as part of a game save for insurance,
we were calling remember_topl() and thus inappropriately changing topline
state.  This would cause us to mis-manage the topline in subsequent calls
to update the topline.

The code has been re-worked to fix the issue, reduce complexity and make
the code clearer.

5 years agoAdding ptr_array data structure.
Bart House [Sat, 13 Jul 2019 23:08:08 +0000 (16:08 -0700)]
Adding ptr_array data structure.

5 years agoRemoving assertion that does not hold under all scenarios.
Bart House [Sat, 13 Jul 2019 17:53:53 +0000 (10:53 -0700)]
Removing assertion that does not hold under all scenarios.

When we save gamestate as part of making an insurance snapshot, we will
save message history which will clear toplines but leaving window state
in tack including the need for more.

5 years agoFix compiler warnings.
Bart House [Sat, 13 Jul 2019 16:52:56 +0000 (09:52 -0700)]
Fix compiler warnings.

5 years agomakedefs doesn't use STATIC_OVL macro
nhmall [Sat, 13 Jul 2019 04:28:51 +0000 (00:28 -0400)]
makedefs doesn't use STATIC_OVL macro

5 years agoif prototype is declared static make function static to match
nhmall [Sat, 13 Jul 2019 04:17:23 +0000 (00:17 -0400)]
if prototype is declared static make function static to match

Today, a compiler was encountered that considered it an error
to have the prototype declared static and the function body
not

5 years agoTweaks to nhassert implementation. Change to warnings on MSC build.
Bart House [Sat, 13 Jul 2019 01:40:34 +0000 (18:40 -0700)]
Tweaks to nhassert implementation.  Change to warnings on MSC build.

5 years agoFixed sign/unsigned comparisions.
Bart House [Sat, 13 Jul 2019 01:37:33 +0000 (18:37 -0700)]
Fixed sign/unsigned comparisions.

5 years agoAdded nhassert to core.
Bart House [Fri, 12 Jul 2019 05:01:39 +0000 (22:01 -0700)]
Added nhassert to core.

5 years agoComment out nhassert() calls.
Bart House [Fri, 12 Jul 2019 04:23:12 +0000 (21:23 -0700)]
Comment out nhassert() calls.

5 years agoAdded assertions to check toplin state.
Bart House [Fri, 12 Jul 2019 03:58:20 +0000 (20:58 -0700)]
Added assertions to check toplin state.

5 years agoFixed bug with inmore and toplin state management.
Bart House [Fri, 12 Jul 2019 04:04:29 +0000 (21:04 -0700)]
Fixed bug with inmore and toplin state management.

When fuzzing, we would increment ttyDisplay->inmore but then prematurely
exit more() leaving ttyDisplay->inmore set.

Under various conditions, we can request to remember the topline when
the topline had not yet been acknowledged leaving toplin state in an
inappropriate state.

5 years agoModified nhassert_failed to call impossoible.
Bart House [Fri, 12 Jul 2019 03:55:27 +0000 (20:55 -0700)]
Modified nhassert_failed to call impossoible.

5 years agoRemove the remapping of snprintf to _snprintf when compiling with MSC.
Bart House [Fri, 12 Jul 2019 03:46:19 +0000 (20:46 -0700)]
Remove the remapping of snprintf to _snprintf when compiling with MSC.

_snprintf and snprintf have one very important semantic difference.
_snprintf does NOT add terminating null character when the buffer limit
is reached while snprintf guarantees a terminating null character.  It
was a mistake to make this naming change hiding the fact that the
semantics don't match what the developer might expect.

5 years agoMoved declaration of topline state to wintty.h.
Bart House [Thu, 11 Jul 2019 23:34:25 +0000 (16:34 -0700)]
Moved declaration of topline state to wintty.h.

5 years agopoly'd hero theft fix
PatR [Thu, 11 Jul 2019 20:29:33 +0000 (13:29 -0700)]
poly'd hero theft fix

I moved some stuff around after testing the changes in
58583cacf8511625fd805ecbb050481f28de9411 before committing it.  It
accidentally ended up with 'gold' always being Null at the first
place it gets used (to vary the feedback when stealing everything
except gold).

5 years agomake #panic honor paranoid_confirmatin:quit
PatR [Thu, 11 Jul 2019 09:54:02 +0000 (02:54 -0700)]
make #panic honor paranoid_confirmatin:quit

If 'paranoid_confirmation:quit' is set, require "yes" instead of 'y'
to execute the wizard mode #panic command.

5 years agocurses: #extended command vs erase/kill chars
PatR [Thu, 11 Jul 2019 08:02:34 +0000 (01:02 -0700)]
curses: #extended command vs erase/kill chars

Support erase char and kill char when getting an extended command.

Also, show the cursor so that it's obvious where input focus is.

5 years agoImproved readability of topline state management.
Bart House [Thu, 11 Jul 2019 05:16:08 +0000 (22:16 -0700)]
Improved readability of topline state management.

5 years agohero-as-nymph: steal items vs steal gold
PatR [Thu, 11 Jul 2019 00:56:33 +0000 (17:56 -0700)]
hero-as-nymph: steal items vs steal gold

Nymphs won't steal gold from the hero (so that their steal-item damage
isn't a superset of lerprechaun's steal-gold damage; straightforward
back when gold wasn't kept in inventory), but hero poly'd into a nymph
would steal gold from monsters.

5 years agofix github issue #204 - theft while in nymph form
PatR [Wed, 10 Jul 2019 23:15:11 +0000 (16:15 -0700)]
fix github issue #204 - theft while in nymph form

Fixes #204

3.6.2's attempts to fix turning off SEDUCE in 'sysconf' introduced
an unintentional change in behavior for hero poly'd into nymph form:
theft attack always angered the target.  The actual change was
intentional but its ramifications were unexpected.

5 years agoAdded experimental feature NEW_KEYBOARD_HIT.
Bart House [Wed, 10 Jul 2019 05:30:34 +0000 (22:30 -0700)]
Added experimental feature NEW_KEYBOARD_HIT.

5 years agocurses: ncurses vs Ctrl+Click
PatR [Wed, 10 Jul 2019 01:55:10 +0000 (18:55 -0700)]
curses: ncurses vs Ctrl+Click

Asking curses to report whether the Ctrl key was being pressed during
a mouse click was sending mouse position reports--even those aren't
being requested--and actual Ctrl+Left_click was reporting a pair of
duplicate Ctrl+Mouse_position_report events when a click was actually
performed.  So turn off Ctrl key reporting.

Mac with one-button mouse can be configured to send "secondary click"
for Ctrl+Click.  A laptop trackpad handles that differently (press the
button while two fingers are on the touchpad to send secondary click)
and doesn't support Ctrl+Click as an alternate way to do that.  If this
would work within curses then they could operate the same regardless
of how the user set the mouse or trackpad configuraiton.  But I wasn't
able to make it work right.

5 years agofix github issue #200 - docs for 'strange object'
PatR [Wed, 10 Jul 2019 00:42:32 +0000 (17:42 -0700)]
fix github issue #200 - docs for 'strange object'

Fixes #200

The Guidebook claims that there's no symbol for 'S_strange_object'
which is literally true, but there is one for S_strange_obj.  It has
been in place longer than the paragraph claiming that there's no way
to customize that symbol.  I'm not sure why variant spelling was used.

Also, files.c doesn't use loadsyms[], it calls a routine which returns
a pointer to a specific element in that array.

5 years agolooking at a trapped monster
PatR [Tue, 9 Jul 2019 00:38:00 +0000 (17:38 -0700)]
looking at a trapped monster

would describe it as trapped if you could see its location, but if
the trap was unseen that trap would remain unseen, at least in some
circumstances.  Mark the trap as seen.

5 years agofinding hidden monsters
PatR [Mon, 8 Jul 2019 23:57:52 +0000 (16:57 -0700)]
finding hidden monsters

Wizard mode ^E and any mode spell of detect unseen or wand of secret
door detection failed to find mon->mundetected monsters if they were
hiding under objects, and failed to find those or other hiders or
mimics when the hidden monster was at a trap location.  The fix for
the latter initially only worked if the trap was known, so took two
tries when a monster hid at the location of an unseen trap.  So this
makes the additional change to find both things at the same time; it
isn't manual searching that stops as soon as something is found.

5 years ago^X/disclosure of night, moon, Friday 13th
PatR [Sun, 7 Jul 2019 20:52:24 +0000 (13:52 -0700)]
^X/disclosure of night, moon, Friday 13th

For ^X and final disclosure, report external issues that affect game
play:  midnight, other night, new or full moon, and Friday the 13th.

The 'new feature' entry in the fixes file rambles a bit but if it
heads off even one spurious bug report, it'll have been worth it.

5 years agofix #H8164 - kicking altar: injury vs wrath
PatR [Sun, 7 Jul 2019 01:14:30 +0000 (18:14 -0700)]
fix #H8164 - kicking altar: injury vs wrath

When kicking an altar, trigger divine wrath (minor: luck or alignment
loss) before deciding whether hero has hurt himself in the process.

Add some variation to the wrath penalty so that it can't be used to
precisely control Luck.

5 years agocurses moving left with ^H
PatR [Sat, 6 Jul 2019 23:41:04 +0000 (16:41 -0700)]
curses moving left with ^H

Typing ^H actually passed a 16-bit value back to the core which got
interpreted as ^G after the extra bits were discarded.  I don't think
any previous changes to the curses interface caused this.  It's
astonishing that no one ever noticed; the world must be full of numpad
users.

5 years agoXstairs_room followup
PatR [Sat, 6 Jul 2019 23:18:23 +0000 (16:18 -0700)]
Xstairs_room followup

Add a comment to explain why upstairs_room, dnstairs_room, and
sstiars_room aren't handled the same way has other level data.

5 years agomklev() set xxstairs_room pointers back to NULL upon completion.
Bart House [Sat, 6 Jul 2019 21:18:02 +0000 (14:18 -0700)]
mklev() set xxstairs_room pointers back to NULL upon completion.

When mklev() is called multiple times, previous state stored in the
xxstairs_room pointers can be mistakenly used when making decisions about
the new level being constructed.  This caused non-deterministic level
creation behavior when replaying from a snapshot.

5 years agoWhen fuzzing, use the number of moves as a proxy for the hour.
Bart House [Fri, 5 Jul 2019 01:06:56 +0000 (18:06 -0700)]
When fuzzing, use the number of moves as a proxy for the hour.

Every 1000 moves simulates one hour.

5 years agocurses prompting tweak
PatR [Thu, 4 Jul 2019 22:56:08 +0000 (15:56 -0700)]
curses prompting tweak

With 'popup_dialog' On, a prompt which exactly fills the available
width would start the next line with a space (to separate the prompt
from user's answer) and then have the cursor waiting after it.  That's
unlike other behavior in the curses interface where the line split
would be instead of the separating space rather than in addition to it.

Old:
|long prompt?|
| X__________|
New:
|long prompt?|
|X___________|
where the X represents the cursor sitting over the start of blank space
waiting for user's answer.

5 years agofix github issue #202 - worn items inside engulfer
PatR [Thu, 4 Jul 2019 01:30:55 +0000 (18:30 -0700)]
fix github issue #202 - worn items inside engulfer

Fixes #202

When swallowed, you can take things from the engulfer's inventory, if
there are any, via pickup.  Items might be worn by the engulfer and
when "picked up" those weren't being unworn before being added to
hero's inventory.  Then they would be formatted as "(being worn)" and
could trigger warnings or worse.

Conceptually they should be worn on the outside and not be accessible
from the inside, so I've made attempts to pick up worn items fail
rather than fix up the unwearing.

Using ':' when swallowed to look at the engulfer's inventory describes
that inventory as "contents of <mon>'s stomach".  That's weird for any
worn items, but the situation is so rare I haven't made any attempt to
deal with it.

5 years agoshk doname for containers
PatR [Wed, 3 Jul 2019 20:43:24 +0000 (13:43 -0700)]
shk doname for containers

Rescue some old code from bit rot.  It may be useful if the shop
side of things ever gets fixed.  (Itemized billing reveals container
contents.  I'm sure that it's in the bugzilla list but can't find it.)

5 years agomakedefs dat/options TERMINFO
PatR [Wed, 3 Jul 2019 18:57:19 +0000 (11:57 -0700)]
makedefs dat/options TERMINFO

Noticed after building a curses-only binary; configuration setting
"terminal info library" is only of interest as an optional feature
when the build includes tty.  There were several other settings that
apply to some interfaces and not others but would be listed if the
feature was defined (possibly after building for an interface which
supported it, then left in place when switching to another which
doesn't).

I left most of those with commented out conditionals in case other
interfaces start supporting them.  So you might still get something
like "tiles file in XPM format" for a binary that doesn't support
tiles if USE_XPM has been defined for some reason.

5 years agoFix crash that can occur in decode_mixed.
Bart House [Wed, 3 Jul 2019 02:08:50 +0000 (19:08 -0700)]
Fix crash that can occur in decode_mixed.

If a player names an object with a name that ends in '\\', drops
that object on the floor nearby and does a look at nearby objects,
then the game will crash.  This is caused by stack corruption when
the decode loop skips over the decode string terminator.

5 years agostatus_hilite for Xp and Exp by percent rules
PatR [Wed, 3 Jul 2019 00:39:23 +0000 (17:39 -0700)]
status_hilite for Xp and Exp by percent rules

Extend support for highlight rules that specify percentages from HP
and spell power to experience level and experience points.  For both
of those, the percentage is based on progress from the start of the
current Xp level to the start of the next Xp level.  100% isn't
possible so is used to enable highlighting a special case:  1 point
shy of next level, most likely to occur after losing a level.

This is something I had in mind a long time ago and then forgot all
about until fiddling with the final disclosure of experience points
recently.  It turned out to be trickier than expected because it needs
to check whether Xp should have a status update when it hasn't changed
but Exp has gone up.  The latter might hit a percentage threshold that
switches to another highlight rule.  Fortunately changes to Exp, at
least that aren't part of level gain or loss (which always trigger
status updating), are all funnelled through a single place (I hope).

5 years agoa bit that crept in from elsewhere
nhmall [Tue, 2 Jul 2019 18:06:14 +0000 (14:06 -0400)]
a bit that crept in from elsewhere

5 years agotest and adjust for curses with msdos
nhmall [Tue, 2 Jul 2019 18:01:44 +0000 (14:01 -0400)]
test and adjust for curses with msdos

5 years agotty status highlighting via attributes
PatR [Tue, 2 Jul 2019 08:37:04 +0000 (01:37 -0700)]
tty status highlighting via attributes

Highlighting via attributes got broken three months ago.  May or
may not have been noticeable depending upon which attributes are
supported.  Too many variations of attribute designations...

5 years agofix up Windows gcc Makefile
nhmall [Mon, 1 Jul 2019 02:19:37 +0000 (22:19 -0400)]
fix up Windows gcc Makefile

5 years agoWhen restoring game we should not need to invoke rnd to test for hiding.
Bart House [Sun, 30 Jun 2019 23:41:24 +0000 (16:41 -0700)]
When restoring game we should not need to invoke rnd to test for hiding.

5 years agoNeed to check ball and chain after we have procesed floor objects.
Bart House [Sun, 30 Jun 2019 23:34:41 +0000 (16:34 -0700)]
Need to check ball and chain after we have procesed floor objects.

5 years agolast NetHack-3.6 travis build passed so re-enable notifications to devteam
nhmall [Sun, 30 Jun 2019 20:54:34 +0000 (16:54 -0400)]
last NetHack-3.6 travis build passed so re-enable notifications to devteam

5 years agowishing vs EDIT_GETLIN
PatR [Sun, 30 Jun 2019 20:45:14 +0000 (13:45 -0700)]
wishing vs EDIT_GETLIN

If you ask for help when wishing, don't leave "help" in the buffer
for EDIT_GETLIN to use as default answer on next retry.  It does still
leave anything rejected as unknown so that the player has a change to
review the spelling and conceivably add and/or remove from the end
witout having to retype everything.

5 years agocurses message history vs dumplog message history
PatR [Sun, 30 Jun 2019 18:50:08 +0000 (11:50 -0700)]
curses message history vs dumplog message history

When I implemented getmsghistory()/putmsghistory() for curses I was
assuming that DUMPLOG would only be used with tty, but it is interface
neutral and can be used with curses (or others).  So curses message
history needs to behave like tty message history and be sure to pass
along messages that bypass pline() and the normal message window.
(Mainly one-line summaries of long quest messages, but also old
messages fetched from a save file and available to be re-saved without
having been shown if new session doesn't generate enough new messages
to flush them.)