Commit Graph

255 Commits

Author SHA1 Message Date
nhmall
05ec7f36a8 Merge branch 'NetHack-3.6.2' 2019-01-29 22:34:07 -05:00
PatR
37e5a9cad2 randrole() fix
Give all the calls to randrole() its new argument.
2019-01-29 17:14:55 -08:00
nhmall
58f2218c4e Merge branch 'NetHack-3.6.2' 2019-01-09 07:24:18 -05:00
nhmall
fac470096b Merge branch 'NetHack-3.6.2' 2018-12-29 12:37:27 -05:00
nhmall
eed7c4bdd1 nttty topten output processing
switch back to using the safe routines
after tty port exits on Windows console
tty port.

Fixes H7758
1613
2018-12-29 12:26:33 -05:00
Bart House
06f8450be1 Merge branch 'win-wip3.7' into win-wip3.7-bart 2018-12-25 18:35:09 -08:00
Bart House
769ad91cc3 mthrowu, nhlan, options, regions, rip and role globals moved to g. 2018-12-25 16:26:27 -08:00
nhmall
7974533eab Merge branch 'NetHack-3.7' into win-wip3.7 2018-12-25 16:35:45 -05:00
nhmall
eb1f430ff5 Merge branch 'NetHack-3.6.2' 2018-12-25 16:34:07 -05:00
Bart House
b1ab64db43 program_state moved to g. 2018-12-25 10:09:04 -08:00
Bart House
16db7498d0 UNIX, VMS, DEF_PAGER, MICRO and MFLOPPY globals moved to g. 2018-12-25 09:34:24 -08:00
Bart House
0763046c38 zeroX, tc_gbl_data and fqn_prefix moved to instance globals. 2018-12-25 08:09:37 -08:00
Bart House
1c65e6afe0 context to g.context 2018-12-25 07:29:38 -08:00
PatR
02cfd131ee status gold vs symset:Blank
Symset:Blank sets all the map symbols (except STRANGE_OBJECT) to
<space>.  The status lines for !STATUS_HILITES force status to use '$'
instead of ' ' for the prefix before ":1234" for gold, but the status
lines for STATUS_HILITES did not.  tty ended up with ":1234" for gold.
win32 and curses both ignore the prefix and construct their own, but
since win32 uses the map symbol for that it must also be ending up
with ":1234" (I assume; I haven't seen it).  curses is forcing '$' for
the prefix, even on the rogue level.

This attempts to fix win32 without be able to test the result.  I've
left curses alone.
2018-12-24 18:43:51 -08:00
Bart House
572ee347b9 Another round of instance globals changes. 2018-12-24 16:43:50 -08:00
Bart House
74edf42f1c Moved decl.c globals into instance globals. 2018-12-22 18:44:22 -08:00
Bart House
b863fad3ea Changes needed in the mac terminal port due to globals changes. 2018-12-22 13:53:10 -08:00
Bart House
576eece500 More globals moved to instance_globals. 2018-12-19 21:26:35 -08:00
Bart House
912886a73f First set of changes to move globals to instance_globals. 2018-12-19 20:00:35 -08:00
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