Commit Graph

8959 Commits

Author SHA1 Message Date
nhmall
aa9e03eef8 PDCurses behaves the same as ncurses 2019-06-27 23:20:13 -04:00
nhmall
99aa1b9bc5 Merge branch 'master' into NetHack-3.7 2019-06-27 23:15:46 -04:00
nhmall
1509aea758 Merge branch 'NetHack-3.6' 2019-06-27 23:15:07 -04:00
PatR
928534509f UNIX|VMS compile warning
So no one on Unix or Unix-like ever builds without tty support?

options.c:694:11: warning: unused variable 'opts' [-Wunused-variable]

Noticed when producing a curses-only binary to verify that erase_char
and kill_char weren't relying on tty being present.
2019-06-27 17:42:56 -07:00
PatR
df8eac79b5 curses erase char and kill char
Support user's terminal settings for erase char and for kill char.
Erase char is typically <delete> or <backspace>, both of which are
already explicitly handled so probably no effect there.  Kill char
(generally ^U these days) will be honored unless it is a printable
character (don't know whether there are any troglodytes out there
who still use '@' for that...).  The current handling for ESC works
the same if there is any input to kill, but yields 'cancelled' when
there isn't.

That's for message window getline(), which operates char-by-char.
The popup getline() uses a curses routine to get an entire string
and already honors kill char but treats ESC as input of ^[.
2019-06-27 17:18:07 -07:00
nhmall
924a0e691f Merge branch 'master' into NetHack-3.7 2019-06-27 00:00:58 -04:00
nhmall
28879d296d Merge branch 'NetHack-3.6' 2019-06-26 23:52:56 -04:00
PatR
fa4f9bb8ae coalescing partly eaten globs
Another one which has been around for a while.  When merging two
globs, the result is partly eaten if either (or both) of them was
partly eaten, not just when the one that's going to stick around as
the combined glob already was.
2019-06-26 15:37:17 -07:00
PatR
54e2e71319 mpickobj sanity, ball&chain theft feedback
Something I've had sitting around for quite a while.  Add a sanity
check to mpickobj().  (It will need tweaking if b&c are changed to be
in engulfer's inventory.)

Also, include more information in the feedback when a nymph steals
attached iron ball:  "Nymph removed your chain and stole a heavy iron
ball".

And don't set the avenge-ok flag if uball is the item stolen since
thief was doing hero a favor, or for anything when the thief is under
the influence of Conflict.
2019-06-26 15:33:40 -07:00
nhmall
7e268d7952 macosx warning suppression final for tonight 2019-06-25 22:11:31 -04:00
nhmall
1ab2fff539 macosx warning suppression part 4 2019-06-25 22:09:25 -04:00
nhmall
06c4b6cd7e macosx warning suppression part 3 2019-06-25 21:44:38 -04:00
nhmall
7775918a1a macosx warning suppression part 2 2019-06-25 21:17:39 -04:00
nhmall
1b058e4f2a more warning suppression from unused variables 2019-06-25 21:04:37 -04:00
nhmall
ed97095670 Merge branch 'master' into NetHack-3.7 2019-06-25 15:59:39 -04:00
nhmall
9b467c7c06 Merge branch 'NetHack-3.6' 2019-06-25 15:54:08 -04:00
PatR
88f19c57e4 ball&chain bit
A check for bad restoration (ball without chain or vice versa) issued
a warning but then left the problem around to trip up other code.
'Fix' the problem by clearing those owornmask slots and their pointers.
Doesn't try to recover memory if the one that's found is OBJ_FREE.

Also some formatting.
2019-06-25 11:02:07 -07:00
nhmall
dedff68f5a remove a 3.6 save file compat kludge and clear another warning 2019-06-25 10:20:06 -04:00
nhmall
fade914218 Merge branch 'master' into NetHack-3.7 2019-06-25 09:42:49 -04:00
nhmall
78805516be Merge branch 'NetHack-3.6' 2019-06-25 09:42:13 -04:00
PatR
d0a32762ab keyhelp typo 2019-06-25 03:27:42 -07:00
PatR
4f0b1262c5 curses clipped map 'scrollbars'
The position bars shown by curses when the map is clipped weren't
being drawn as intended (integer arithmetic).  Changing parentheses
was enough to get it working, but it didn't handle the edge case
where non-zero got rounded to 0 (so when map was panned down, the
uppermost character of the vertical position bar still showed '*',
falsely indicating that top of map was currently within view.
2019-06-25 03:17:47 -07:00
PatR
3bd46a3536 curses cursor
Followup to 1c03d0970115c776d1c4791fea3c33f70b0b5378; that had been
too easy.  When map was clipped and panned to the side, the highlight
for hero's spot was shown next to the '@' instead of on it.
2019-06-25 02:30:27 -07:00
nhmall
163a9287f5 shadow variable bit in version.c 2019-06-25 01:10:47 -04:00
nhmall
bbedd61c9e even more macosx warnings 2019-06-25 01:07:18 -04:00
nhmall
972284061d yet more macosx warnings 2019-06-25 00:55:01 -04:00
nhmall
f6ab39fde1 more macosx warnings 2019-06-25 00:44:05 -04:00
nhmall
eec5d0390f Merge branch 'master' into NetHack-3.7 2019-06-24 23:54:49 -04:00
nhmall
51c232b8f8 Merge branch 'NetHack-3.6' 2019-06-24 23:53:08 -04:00
nhmall
560f21f5db quiet some macosx warnings 2019-06-24 23:48:37 -04:00
PatR
6506f769a6 fix #H7840 - curses ':' menu search+toggle
Using ':' to have search string matching toggle items chosen for
selection would show selection highlighting on the current page for
items matched off-page.
2019-06-24 19:28:50 -07:00
PatR
8a9c06f5c1 'sortpack' vs 'perm_invent'
The persistent inventory window wasn't being updated if you toggled
the 'sortpack' option interactively.  (The new setting was honored
once something else triggered a 'perm_invent' update.)

The logic for toggling 'fixinv' seemed backwards.  I hope this "fix"
for that hasn't actually broken it.
2019-06-24 18:54:38 -07:00
PatR
e3af33c9db curses 'perm_invent' fixes
I noticed the wrapping issue while testing out the 'bad fruit' fix,
then the other things while fixing it.

1) inventory entries too wide for narrow persistent inventory window
   wrapped without any control; normally can't be seen except for the
   last entry when the list is short enough to leave at least one line
   available; it looked fairly reasonable with window borders Off, but
   when On the last char of the first line and first char of second
   line were clobbered by the border box;
2) when there were too many entries to fit within the height, those
   after the last one which fit were appended to it for borders Off
   (or written on bottom line and then overwritten by the border box
   for borders On); noticed because the selector letter is highlighted
   with inverse video, even when written at an unexpected place;
3) suppress the inverse video hightlighting of inventory letters since
   they can't be selected from that 'menu';
4) for borders Off, the top line was left blank as if a border was
   going to be drawn there;
5) since the entries are truncated due to the narrow window (on a
   modest sized display), strip off leading "a", "an", or "the" prefix
   for inventory entries (written to curses perm_invent window only);
   lets a couple more characters of more interesting stuff be seen.
2019-06-24 18:39:24 -07:00
nhmall
e34c7daf02 Merge branch 'master' into NetHack-3.7 2019-06-24 19:47:22 -04:00
nhmall
47c5a14ff4 Merge branch 'NetHack-3.6' 2019-06-24 19:38:02 -04:00
PatR
cfc8599e69 fix "Bad fruit #N" warnings when saving bones
savebones() sets all the fruit indices negative, then resets to the
normal positive value for each fruit it actually writes into the bones
file.  But if 'perm_invent' is enabled and something triggers an
update_inventory() while bones saving is in progress, object formatting
for the inventory display won't be able to find any fruits, resulting
in impossible "Bad fruit #N".  Fix is to turn off 'perm_invent' when
the game ends, so it won't be On when bones are written.  Disclosure
uses a popup for inventory so persistent window is obsolete by then
anyway.

[I don't know what is triggering update_inventory() while savebones()
is executing.  Also, I don't see where the fruits whose index stayed
negative--because there aren't any on level being saved--get purged.
Maybe when those bones are loaded by another game?]
2019-06-24 15:11:51 -07:00
Bart House
ed08938ada Fix dangling chain bug.
If a punished player picks up the iron ball, gets engulfed and
saves, then the saved game will have missed saving the dangling
chain since it was not on the floor or in the inventory.  Upon
restoring the saved game, the game will be in a bad state since
the ball will be worn but the chain will be missing.
2019-06-23 21:39:22 -07:00
nhmall
f6ef689778 Merge branch 'master' into NetHack-3.7 2019-06-23 22:06:59 -04:00
nhmall
0ac3e25633 Merge branch 'NetHack-3.6' 2019-06-23 22:06:13 -04:00
PatR
87be6fad43 worm segment placement
random_dir() for picking a spot to put a segment of a long worm's tail
(when it is being placed on the map, perhaps after teleport, not when
movement allows it to grow) had mistakes in three of the four compass
directions.  The one for the top of the map was benign; it just
neglected to use the top row (#0).  But it could pick a value off the
edge of the map for bottom and right or both.

This doesn't explain a couple of long worm [segment] oddities on the
Astral level because that level doesn't go all the way to the edge.
2019-06-23 18:48:13 -07:00
nhmall
69c01fb3ec Merge branch 'master' into NetHack-3.7 2019-06-23 21:12:08 -04:00
nhmall
df35f7282a Merge branch 'NetHack-3.6' 2019-06-23 21:11:28 -04:00
PatR
68d28bd748 level overcrowding tweaks
A couple changes dealing with overcrowded levels.  So many monsters
are moving from the Plane of Water to the Astral Plane that the
latter can start out completely full.

Give monsters who trigger the endgame portals a 6/7 chance to not go
through ('home' elementals or any monster carrying the Amulet already
wouldn't go through).  They should learn about magic portal trap in
the process and not voluntarily step on that afterward.

When the Wizard or other covetous monster tries to teleport next to
the hero and fails, he was being sent to limbo.  There's no need for
that; he's already on the map and can just stay where he is.  That
doesn't actually help with the endgame population issue, it just
fixes a couple of uses of mnearto().

I have significant changes for mnearto() and elemental_clog() that
also help with this but will test those more before committing.
2019-06-23 17:27:15 -07:00
PatR
83410a3d4f \#wizidentify bug - 'Not carrying anything.'
when carrying things.  The fuzzer toggled on 'perm_invent' and after
interrupting it I used ^I.  Having 'perm_invent' enabled makes the
inventory code avoid having a totally empty inventory display (by
supplying "Not carrying anything" instead--in the menu rather than
via normal pline) so that interface code will see a change and know
that an update is needed.  But to decide whether the menu was empty,
the inventory code was testing union 'any' field 'a_char' to check
whether some item had used the union (implying that something had
been passed to add_menu()), but wizidentify (^I) uses field 'a_obj'
instead.  Apparently the a_char bits stayed 0 because the menu ended
up with "Not carrying anything" after a list of inventory items.
Switch to a separate variable to track whether anything has been put
into the menu instead of trying to rely on the union.

Unrelated but noticed when checking other "Not carrying anything"
instances, the #adjust command ends early when there's no inventory
but it was asking for a letter to adjust even when the only thing in
inventory was gold in '$' slot, which isn't allowed to be adjusted
away from that slot.  Treat gold-only like no-invent.
2019-06-23 11:31:21 -07:00
nhmall
ba0f6ed47f updated files 2019-06-23 00:57:38 -04:00
nhmall
adce0147e0 missed one file 2019-06-23 00:47:30 -04:00
nhmall
7054e06e42 NetHack minor release checklist items - savefiles
Make some progress on a couple of next minor release checklist
items, hopefully without introducing too many new bugs. This
is just the initial commit, and work continues.

Checklist items:

Savefiles compatible between Windows versions, whether 64-bit
or 32-bit in little-endian field format.

Selection of file formats:
 historical (structlevel saves),
 lendian (little-endian, fieldlevel saves),
 and just for proof-of-concept, ascii fieldlevel saves
 (the ascii is huge! 10x bigger than little-endian).

For the fieldlevel save, all complex data structures recursively
get broken down until until it is one of the simple types that
can't be broken down any further, and that gets when it gets
written to the output file.

New files needed for this build:

hand-coded:
include/sfprocs.h
src/sfbase.c      - really a dispatcher to one of the
                    output/input format routines.
src/sflendian.c   - little-endian output writer/reader.
src/sfascii.c     - ascii text output writer/reader.

auto-coded (generated):
include/sfproto.h
src/sfdata.c

This is just one approach. I'm sure there are countless others
and they have different pros and cons.

For producing the auto-coded files a utility called
universal-ctags, that is actively maintained and evolving,
was used to do all the heavy-lifting of parsing the
NetHack C sources to tabulate the data fields, and store
them in an intermediate file called util/nethack.tags
(not required for building NetHack if you already have a
generated include/sfproto.h and src/sfdata.c)

util/readtags (also not required for building NetHack
itself) will decipher the nethack.tags file and produce
the functions that can deal with the NetHack struct data
fields.

You can obtain the source for universal-ctags by cloning it
from here:
https://github.com/universal-ctags/ctags.git

The combination universal-ctags + util/readtags has been
tried and tested under both Windows and Linux, so it is
not tied to a particular platform.

Note: util/readtags will work only with universal-ctags
output, so other ctags are unlikely to work as-is.
Universal-ctags can be build from source very easily
under Linux, or under Windows using visual studio.
2019-06-23 00:11:46 -04:00
nhmall
c9e8ae6323 Merge branch 'NetHack-3.6' 2019-06-22 22:03:07 -04:00
PatR
c968f03af3 makemon() and clone_mon()
Express the logic of various early returns more consistently.

clone_mon() wasn't handling mon->isminion correctly.  I'm not sure
whether it is actually possible to clone a minion (maybe after
polymorphing it into a gremlin or blue jelly?).  When it wasn't tame,
which is the case for every minion other than the guardian angel on
Astral, the emin structure wasn't being allocated for the clone but
its isminion flag was left set.

Also, clones inherited mon->mtrack[] so would unnecessarily avoid
moving onto spots the original had recently moved across.

Cloned pets are inheriting various pet-specific fields that they
probably should be starting with a clean slate on but I haven't made
any attempt to address that.
2019-06-22 13:47:35 -07:00
PatR
456996509b fix #H8922 - no "you finish eating" message
after being interrupted and then resuming.  Resuming a multi-turn
food when it only had one bite left was the culprit.
2019-06-22 13:03:50 -07:00