Commit Graph

236 Commits

Author SHA1 Message Date
PatR
594cb5f226 tty SIGHUP
We still don't know whether this will be of any help against
disconnected processes that hog the CPU instead of exiting, but I
don't think it imposes significant overhead on ones which aren't
disconnected.  Install it before it suffers from more bit rot.
2018-12-15 16:24:59 -08:00
PatR
436f8a9fde tty status condition: Cf, Hl, Rd
While the fuzzer was running, amidst the continual screen updating I
caught a glimpse of "Cn" and was puzzled about how the hero became
cancelled.  I quickly realized it actually meant confused, but I
think "Cf" is a better abbreviation for that.  I've also changed "Ha"
to "Hl" for hallucination and "Ri" to "Rd" for riding.  The rest is
formatting.
2018-12-14 18:51:07 -08:00
Pasi Kallinen
8319227b55 Clear the getlin buffer
Recent change to this bit of code didn't clear the buffer,
which causes garbage in the string if compiled with EDIT_GETLIN
2018-12-07 22:18:53 +02:00
PatR
f2195c1212 more !SHELL, !SUSPEND
Update tty command completion to ignore #shell and #suspend when
they're disabled.  (Since they aren't flagged for command completion,
this should be unnoticeable.)

Update X11 extended command selection to not show shell and suspend
in the menu when they're disabled.  (Trickier than I expected.)

X11 currently rejects #suspend (at run time, not compile time) but
allows #shell.  If it was launched syncronously from a terminal
window, shell escape behaves sanely.  Otherwise, that seems like
asking for trouble.
2018-12-03 01:46:01 -08:00
nhmall
57a02d05bf build fix when STATUS_HILITES is not defined 2018-11-24 21:41:22 -05:00
nhmall
053baa8274 Revert "restore.c globals moved to instance_globals."
This reverts commit 865c4d5a7d.
2018-11-23 22:16:59 -05:00
nhmall
44af1c78f3 Revert "topl.c globals moved to instance_globals."
This reverts commit b384223e1b.
2018-11-23 22:16:45 -05:00
Bart House
b384223e1b topl.c globals moved to instance_globals. 2018-11-23 15:22:54 -08:00
Bart House
865c4d5a7d restore.c globals moved to instance_globals. 2018-11-23 15:22:54 -08:00
Bart House
2a6bd3e8ac Addressed compiler warnings.
Added the initialization of several locals.
In check_fields, validate that we have a valid index (idx) before using.
2018-11-20 10:48:44 -08:00
nhmall
cb43061076 curses changes to existing files 2018-11-16 20:51:22 -05:00
nhmall
a0b53ee391 merge 2018-11-11 10:29:52 -05:00
Pasi Kallinen
0bb6754998 Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
2018-11-08 15:55:49 +02:00
PatR
50259daa72 tty/topl.c comment tidbit 2018-10-30 14:26:40 -07:00
nhmall
00dfed5b3a move assignment outside inner loop 2018-09-29 23:38:20 -04:00
nhmall
ef199f3763 one more update for the right of the status line
This tracks the last character written on each row and clears
the previous content from the end independently of which field
is actually involved.
2018-09-29 23:21:11 -04:00
nhmall
d1c5649890 revisit display artifact appearing to the right of status line
The prior fix for this was a bit flawed. It was only considering
the length of the last field, but what it really needed to do was
consider the placement of the last character of the last field
on the row relative to the placement of the last character of
the last field on the row previously.

If the new placement of that last character of the last field
is left of the previous placement, some clearing must be done.
2018-09-29 22:28:10 -04:00
nhmall
394c72d366 display cleanup only targets the right-most field where it's needed 2018-09-28 12:55:30 -04:00
nhmall
bdc9a6b98e follow-up bit 2018-09-28 02:28:54 -04:00
nhmall
5639539568 tty: fix leftover display artifact when last field on the row got smaller 2018-09-28 02:09:07 -04:00
nhmall
c5d0f6dd9d fix out of bounds error in tty_status_update() for BL_HUNGER case
The pointer could go out of bounds when decremented if it was pointing
at the start of the status_vals[BL_HUNGER] (empty string).

Also, guard tty_status_update() from an out of range index being
passed to it (botl shouldn't do that, but...).

The legal 1st parameter values for tty_status_update() in 3.6.2 are

	BL_RESET     (-2)
	BL_FLUSH     (-1)
	BL_TITLE     ( 0)
	...though to...
	BL_CONDITION (22)

  count MAXBLSTATS = (BL_CONDITION + 1)

There's a BL_CHARACTERISTIC (-3) defined in the botl.h header file,
but it is not used in wintty.c and is now screened out along with
everything lower and everything MAXBLSTATS and above.

closes #142
fixes #141
2018-09-26 17:18:09 -04:00
nhmall
21a81d0294 BL_RESET usage for window port status line updating
Like BL_FLUSH, only send BL_RESET if the window port has
indicated it wants them via setting the appropriate WC2
bits in its window_procs structure. Update documentation.
2018-09-22 22:41:02 -04:00
nhmall
7d4a7a1f42 tty column placement of BL_HUNGER and BL_CAP could collide
Change the placement of the code that makes a replica of the
current status fields for later comparison.

A loop shortcut was causing it to be skipped under some
circumstances and that was negatively impacting the placement
of status field values that were further to the right.
2018-09-12 19:42:45 -04:00
nhmall
c00b698b4a hitpointbar bit for prior commit 2018-09-05 20:47:16 -04:00
nhmall
ec43a80e9e stop tty hitpointbar from jumping to 100% health at zero hit points 2018-09-05 20:21:59 -04:00
nhmall
a417d67572 status_update distinguish new BL_RESET from BL_FLUSH
This adds BL_RESET to status_update to send a flag to a window
port that every field should be updated because something has
happened in the core to make current values shown to be
untrustworthy or potentially obliterated.

That is now distinguished from BL_FLUSH, which now has no
bearing on whether every field needs to be redone, and instead
can be used by a window port indicator that it is time to render
any buffered status field changes to the display.

tty port now sets WC2_FLUSH_STATUS indicator for BL_FLUSH support
and now does one rendering per bot() call, instead of up to 22.

Side note: The tty hitpoint bar code was relying on the old
behavior of redrawing everything upon BL_FLUSH apparently, so it
initially had some color change lag issues, corrected by marking
BL_STATUS as dirty (in need of updating) in tty_status_update()
whenever BL_HP was marked as dirty.
2018-09-03 08:18:18 -04:00
nhmall
1462f69f54 reports on windows of partial status lines after level change
tty: turn off an optimization that is the suspected cause of Windows reported
	partial status lines following level changes. It was turned on for
        non-unix platforms only
2018-09-01 14:52:47 -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
fa0a136b06 tty/wintty.c w/o TEXTCOLOR
With TEXTCOLOR disabled, compiler warnings about term_start_color()
and term_end_color() not being declared were followed by link failure
because they weren't available.

This tries to simplify color handling in the tty status code without
resorting to #if TEXTCOLOR (the proper fix, but somewhat intrusive).
For the usual case where TEXTCOLOR is defined, there were instances
of
  if (color != NO_COLOR && color != CLR_MAX)
    term_start_color();
  ...
  if (color != NO_COLOR)
    term_end_color();
and also of
  if (color != NO_COLOR)
    term_start_color();
  ...
  if (color != NO_COLOR)
    term_end_color();
I've changed both types to be
  if (color != NO_COLOR && color != CLR_MAX)
    term_start_color();
  ...
  if (color != NO_COLOR && color != CLR_MAX)
    term_end_color();
so that start/end pairing will always be consistent.

Also, ((color_and_attr & 0xFF00) >> 8) might not work as intended if
using 16-bit int and color_and_attr happened to have its sign bit set.
Change to ((color_and_attr >> 8) & 0x00FF) to ensure just the desired
bits.

Also also, a couple more formatting bits.
2018-05-15 17:09:47 -07:00
nhmall
c2103b84db fix a couple of status items, gold highlighting and a boundary check
typo
gold highlighting
boundary check on tty_curs()
2018-05-15 09:03:35 -04:00
PatR
5586cca8b9 tty status
Started by removing two or three unused variables, ended up cleaning
up a lot of formatting (tabs, trailing spaces, indentation, a few
wide lines, 'if (test) return' on same line).  Marked some static
functions as static in their definitions instead of leaving it hidden
in their prototypes.  Moved a pair of short-circuit checks to skip
several initializations.
2018-05-15 04:16:40 -07:00
nhmall
80218a7855 boundary bit 2018-05-15 01:29:36 -04:00
nhmall
26654ef079 a few cut-and-paste errors 2018-05-14 22:25:25 -04:00
nhmall
2e8b69d5ff some tty per field rendering and optimization 2018-05-14 21:13:37 -04:00
nhmall
860b9c35c1 testing build with STATUS_HILITES 2018-05-13 21:24:14 -04:00
nhmall
0d23e7b44d Merge branch 'tty-status' into win-tty-status 2018-05-13 15:21:46 -04:00
nhmall
3b2f7e86e0 more status updates
- prevent an overflow
- add make_things_fit()
2018-05-13 15:19:39 -04:00
Bart House
1d31a49661 Some nttty.c clean-up. 2018-05-12 15:58:44 -07:00
nhmall
149fc5a4dd empty field suppression caught condition values unintentionally 2018-05-12 14:42:19 -04:00
nhmall
3598fcc929 more status handling updates
Suppress unneeded spaces from a couple of fields
	BL_LEVELDESC	- trailing spaces.
	BL_CAP		- it only contains a space
2018-05-12 14:10:52 -04:00
nhmall
9a87064cca some build fixes for compile issues reported 2018-05-12 06:57:34 -04:00
nhmall
ba057ef3de condition shrinkage when required 2018-05-12 02:18:42 -04:00
nhmall
a3ba46d732 remove some debug code 2018-05-12 01:10:43 -04:00
nhmall
dd04f5fcb5 more tty-status updates 2018-05-12 01:04:57 -04:00
nhmall
8c2dc7bb1c add some logging to debug 2018-05-10 18:48:02 -04:00
nhmall
4dd535cbd2 cross platform testing 2018-05-09 18:47:19 -04:00
nhmall
778c8a56ab remove a commented out code line 2018-05-09 13:25:46 -04:00
nhmall
9bca6ecb8e tty status updates
some status code cleanup

It should be ready to merge tty-status changes into NetHack-3.6.0.
2018-05-09 13:12:11 -04:00
nhmall
b524c26da5 intermediate update to wintty.c as work continues 2018-05-07 18:52:50 -04:00
nhmall
71bead4e39 do some performance optimizations on highlighting of tty status 2018-05-05 19:43:10 -04:00