Commit Graph

8508 Commits

Author SHA1 Message Date
Bart House
0ca299acb3 Added nhassert to core. 2019-07-11 22:01:39 -07:00
Bart House
45a9c5eb14 Comment out nhassert() calls. 2019-07-11 21:23:12 -07:00
Bart House
1db45c8016 Added assertions to check toplin state. 2019-07-11 21:18:57 -07:00
Bart House
0f57f0e48c 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.
2019-07-11 21:17:46 -07:00
Bart House
3e4a0759a3 Modified nhassert_failed to call impossoible. 2019-07-11 21:13:02 -07:00
Bart House
9801635f56 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.
2019-07-11 21:11:43 -07:00
Bart House
7bb41c797f Moved declaration of topline state to wintty.h. 2019-07-11 16:34:25 -07:00
PatR
524f5642d5 poly'd hero theft fix
I moved some stuff around after testing the changes in
58583cacf8 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).
2019-07-11 13:29:33 -07:00
PatR
bfbe4e71ce make #panic honor paranoid_confirmatin:quit
If 'paranoid_confirmation:quit' is set, require "yes" instead of 'y'
to execute the wizard mode #panic command.
2019-07-11 02:54:02 -07:00
PatR
188eedc654 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.
2019-07-11 01:02:34 -07:00
Bart House
08a1910867 Improved readability of topline state management. 2019-07-10 22:16:08 -07:00
PatR
58583cacf8 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.
2019-07-10 17:56:33 -07:00
PatR
094a9d8161 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.
2019-07-10 16:15:11 -07:00
Bart House
bc65112ce0 Added experimental feature NEW_KEYBOARD_HIT. 2019-07-09 22:30:34 -07:00
PatR
0e8163e341 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.
2019-07-09 18:55:10 -07:00
PatR
9eefeef5d2 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.
2019-07-09 17:42:32 -07:00
PatR
77aa61a59b 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.
2019-07-08 17:38:00 -07:00
PatR
cfca15d02c 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.
2019-07-08 16:57:52 -07:00
PatR
ceb2d51426 ^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.
2019-07-07 13:52:24 -07:00
PatR
bac3a75174 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.
2019-07-06 18:14:30 -07:00
PatR
e84a0625dc 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.
2019-07-06 16:41:04 -07:00
PatR
bf672f7f47 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.
2019-07-06 16:18:23 -07:00
Bart House
7e72bc0944 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.
2019-07-06 14:18:02 -07:00
Bart House
f75deae0bc When fuzzing, use the number of moves as a proxy for the hour.
Every 1000 moves simulates one hour.
2019-07-04 18:06:56 -07:00
PatR
7b1c38499d 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.
2019-07-04 15:56:08 -07:00
PatR
79ff4cd9c3 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.
2019-07-03 18:30:55 -07:00
PatR
4a74968a58 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.)
2019-07-03 13:43:24 -07:00
PatR
88a48cd6ff 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.
2019-07-03 11:57:19 -07:00
Bart House
25ea6c8f3c 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.
2019-07-02 19:08:50 -07:00
PatR
1e7fb839a3 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).
2019-07-02 17:39:23 -07:00
nhmall
ad88205229 a bit that crept in from elsewhere 2019-07-02 14:06:14 -04:00
nhmall
1ac321eadc test and adjust for curses with msdos 2019-07-02 14:01:44 -04:00
PatR
8bb8d32625 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...
2019-07-02 01:37:04 -07:00
nhmall
3e86b46f8a fix up Windows gcc Makefile 2019-06-30 22:19:37 -04:00
Bart House
1b0d47911f When restoring game we should not need to invoke rnd to test for hiding. 2019-06-30 16:41:24 -07:00
Bart House
c928cda775 Need to check ball and chain after we have procesed floor objects. 2019-06-30 16:34:41 -07:00
nhmall
e35a216e51 last NetHack-3.6 travis build passed so re-enable notifications to devteam 2019-06-30 16:54:34 -04:00
PatR
4db3b55057 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.
2019-06-30 13:45:14 -07:00
PatR
18ae35ef39 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.)
2019-06-30 11:50:08 -07:00
nhmall
d352dd8d1a Merge branch 'NetHack-3.6' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6 2019-06-30 14:12:48 -04:00
nhmall
7cccf2e4d8 add --depth 1 to git clone for travis windows test 2019-06-30 14:12:16 -04:00
PatR
93ddb5c6d8 attributes disclosure: experience points
Wizard mode shows the number of points needed to reach the next level
(unless already maxxed out at 30) for ^X and end of game disclosure.
Do it in normal play for the latter too.  (I think it would ok to do
that for ^X too but haven't gone that far.)

Even when it was wizard mode only, the phrasing for past tense had a
minor grammar bug, and it could make the line a little too long for
tty and curses (not sure about others) when level was high, resulting
in wrapped text.  That looked bad for tty, which first tries removing
indentation (just 1 space in this case), making that line outdented
as well as wrapped.  So change the phrasing slightly when experience
level is 'too high'.  I had a version which formatted, measured, and
re-formatted if necessary but that was overkill; simple hardcoded
rephrasing suffices particularly when measuring was against assumed
display width (80) rather than actual width.
2019-06-30 10:51:00 -07:00
nhmall
d4ec664b4f add pdcurses support to travis ci windows test builds
pdcurses is obtained on-the-fly from the github source
2019-06-30 13:22:25 -04:00
nhmall
81fef499e0 remove "bogus" bit :) 2019-06-30 12:12:42 -04:00
nhmall
ae9d68d991 lower case windows in .travis.yml 2019-06-30 10:33:53 -04:00
nhmall
148b93a7c1 TRAVIS CI updated to include Windows and osx testing
TRAVIS CI added Windows to their platform list in late 2018.

Update the .travis.yml file to include a pair of Windows in
machines in the testing suite, one built with visual studio
command line tools and the other with mingw gcc tools.

The visual studio build is currently using nmake with the
sys/winnt/Makefile.msc Makefile from our distribution,
That's the same process we've been using for building
our binaries, pretty much.

BRH may be able to modernize it over the next couple of
weeks to use the msbuild process instead.

I went with the HINTS environment variable on windows
for consistent self-documenting purposes, even though
the environment variable isn't used on windows.

included:
   os: linux
   Compiler: gcc C
   HINTS=linux

   os: linux
   Compiler: clang C
   HINTS=linux

   os: linux
   Compiler: gcc C
   HINTS=linux-x11

   os: linux
   Compiler: gcc C
   HINTS=linux-qt5

   os: linux
   Compiler: gcc C
   HINTS=linux-minimal

   os: windows
   language: shell
   HINTS=Windows-visual-studio

   os: windows
   HINTS=Windows-mingw

excluded:
   os: osx
   Compiler: clang
   Xcode: xcode10.2 C
   HINTS=macosx10.14
2019-06-30 10:19:16 -04:00
nhmall
bef9799eb5 No PDCurses right out-of-the-box; requires an edit 2019-06-30 01:10:32 -04:00
nhmall
51f2d610e2 update Windows Makefiles to support TRAVIS CI builds 2019-06-30 01:09:41 -04:00
PatR
8d0edeb4ff curses+EDIT_GETLIN again
Turns the "fix" in commit 319dcf4746
handled removing the default answer for single-line-prompt plus
multi-line-answer but not for multi-line-prompt plus long-enough-
answer-to-reach-another-line.  The logic wasn't quite right and I
misunderstood what is stored in linestarts[] so even correct logic
wouldn't have solved things.
2019-06-28 17:00:20 -07:00
nhmall
7c7f29a2e3 build fix for Windows if pdcurses is included after recent changes
cursmain.o : error LNK2001: unresolved external symbol _erase_char
cursmesg.o : error LNK2001: unresolved external symbol _erase_char
cursmain.o : error LNK2001: unresolved external symbol _kill_char
cursmesg.o : error LNK2001: unresolved external symbol _kill_char
2019-06-28 18:59:06 -04:00