Commit Graph

2221 Commits

Author SHA1 Message Date
nhmall
26e61f30c8 follow-up
Revert the sys/unix/hints/include/compiler.370 for now
while a couple of warnings still exist in role.c
2022-08-29 14:35:39 -04:00
nhmall
443dc429e7 warning-free build without -Wno-missing-field-initializers
Also removes a GCC_WARN usage and the need for
#pragma GCC diagnostic ignored "-Wmissing-braces"
for src/decl.c when using gcc.
2022-08-29 14:06:12 -04:00
PatR
11c8d5cd5e Unix: command line --windowtype:foo fix
initoptions(), including initoptions_finish(), was running to
completion with the default window system before windowtype from the
command was parsed and activated.  When the default window system
is tty without MS-DOS the map type gets set to ascii; command line
--windowtype:X11 doesn't switch it back to the X11 default of tiled.

So,
| NETHACKOPTIONS=windowtype:X11 nethack
ran nethack in tiles mode but
| nethack --windowtype:X11
ran it in text mode (assuming .nethackrc left tiles vs text with the
default setting).

I think this fix is quite iffy but it seems to work as intended....
It reclassifies '--windowtype' as an "early option" in unixmain.c,
and the options.c code ultimately processes it twice.
2022-08-28 00:09:50 -07:00
nhmall
25fc7ea2f5 update tested versions of Visual Studio 2022-08-21 11:51:15 -04:00
Pasi Kallinen
24e94b70d4 Windows: Default boulder symbol to 0
Set the boulder symbol to 0 in the Windows config template file.
2022-08-02 13:09:25 +03:00
nhmall
cf352377a9 Windows stubs.c follow-up 2022-08-01 02:03:38 -04:00
nhmall
174a7e5e78 Windows stubs.c fix 2022-08-01 01:52:55 -04:00
nhmall
0649783a6d some windows startup
noticed that "do you want to destroy the savefile" was not being
handled correctly in Windows startup.
2022-07-16 20:43:24 -04:00
nhmall
cb036d11e2 update tested versions of visual studio 2022-07-16 09:19:03 -04:00
PatR
ab32ec4ad6 config_error_add()'s terminating period
Have the config error reporting routine check whether the message
it's delivering already has end-of-sentence punctuation instead of
adding that unconditionally.
2022-07-05 23:20:58 -07:00
nhmall
c84e0ba6e1 rework TTY_PERM_INVENT; update window port interface
Change the inner workings of the experimental TTY_PERM_INVENT.

Switch to delivering the content to tty for the experimental perm_invent
via the existing window port interface (start_menu(), add_menu(), end_menu).

This also adds a new window port interface call ctrl_nhwindow() for
delivering information to the window port, and/or obtaining specific
information from the window port. The information and requests can
be extended as required. To be documented later once the changes settle
down.

Due to the intrusive nature of these changes and the possibility of
some bugs in the new code, I'm going to leave TTY_PERM_INVENT commented
out in the repository for a day or two.  Anyone wishing to test it out
can do so by uncommenting TTY_PERM_INVENT in config.h.
2022-07-03 00:35:32 -04:00
nhmall
3004cf2d34 be more consistent with coordinates 2022-07-02 09:10:03 -04:00
PatR
dda4cd0530 regex handling
Change the regex_error_desc() interface.  Have the caller pass in
a pointer to a buffer of at least BUFSZ characters and have
regex_error_desc() populate that.  No need for static buffers or
extra dynamic alloction.

Also, change it to never return Null.  None of its callers were
checking for that and could have passed Null to config_error_add()
or raw_print().  printf("%s", NULL) produces "null" on OSX but other
systems would probably crash if a Null result ever actually occurred.

The error explanation returned by cppregex included a trailing period.
config_error_add() adds one, so the message ended up with two.  Have
regex_error_desc() check for final period and strip it off if found.
(My test case used a menucolor pattern of "[" which triggers an error
about mismatched brackets.)

Reformat cppregex.cpp; treat 'extern "C" {' as if it isn't introducing
a nested block.  Fix the '#include <hack.h>' that 'make depend' was
ignoring.
2022-07-01 13:08:43 -07:00
nhmall
aebf77ada1 update visual studio project files 2022-07-01 11:47:02 -04:00
nhmall
1e17efe143 Windows console limits 2022-07-01 08:37:10 -04:00
nhmall
751b6e646f Revert "follow-up: use only the memory that's required"
This reverts commit 4a0654c708.
2022-06-30 22:38:14 -04:00
nhmall
66a1e19d26 Revert "follow-up 2: follow the conventional approach"
This reverts commit 6920632df0.
2022-06-30 22:37:12 -04:00
nhmall
43941afe19 Revert "follow-up 3"
This reverts commit cd57dfa5ff.
2022-06-30 22:36:45 -04:00
nhmall
cd57dfa5ff follow-up 3 2022-06-30 13:27:46 -04:00
nhmall
6920632df0 follow-up 2: follow the conventional approach 2022-06-30 13:15:58 -04:00
nhmall
4a0654c708 follow-up: use only the memory that's required 2022-06-30 13:10:56 -04:00
nhmall
0fd999a6b5 cppregex regex_error_desc()
Address sanitizer caught a use after free.
cppregex.cpp regex_error_desc() was not returning a pointer
to a static buffer, yet the posixregex was. Follow suit.
2022-06-30 13:02:07 -04:00
nhmall
f228fefabd updated window_procs
Add a non-string identifier to window_procs for use in runtime
identification of the current window port being used.

Use a macro WPID to add the identification at the top of the
various existing window_procs declarations. It expands to the
existing text string, as well as the newly added field wp_id
with a wp_ identifier.

For example, WPID(tty) expands to: "tty", wp_tty

The generated wp_tty must be present in the wp_ids enum at
the top of include/winprocs.h.

The WINDOWPORT(x) macro has been updated to expand to a simple
value comparison (port.wp_id == wp_x), instead of a
string comparison.
2022-06-29 23:21:19 -04:00
nhmall
a518d82c54 no quotes in WINDOWPORT macro invocation 2022-06-29 22:13:28 -04:00
nhmall
d2ca61a0a0 TTY_PERM_INVENT tweaks 2022-06-25 22:26:18 -04:00
nhmall
2770223d10 interface groundwork for core-side color decisions
(user-side decisions really, but as it stands right now
user-side decisions/options are made and processed by the core)

add a parameter to add_menu so color can be passed
2022-06-25 13:21:51 -04:00
nhmall
0085cd9e8c updates for msdos cross-compile
gcc 12.1.0

also incorporate a libc patch for djgpp
2022-06-21 03:15:25 -04:00
nhmall
249f8a182f trouble linking
Add a switch to the C files if the ++ linker will be used due
to WANT_WIN_QT=1.
2022-06-20 19:58:16 -04:00
nhmall
65659b2cab experimental config option TTY_PERM_INVENT
Add a rudimentary experimental always-up inventory display
capability to tty when the perm_invent option is in effect.
It requires an additional 28 rows available on the terminal
underneath the bottom status line.

It hasn't been optimized for performance as of yet.
2022-06-20 10:40:55 -04:00
nhmall
1d46fad717 some documentation-related changes
add a command-line pdf option to Makefile for use in CI.
fix .tex file errors.
2022-06-18 13:32:17 -04:00
nhmall
0147b2bfdf follow-up bit 2022-06-18 11:03:59 -04:00
nhmall
40c74a2030 typo in last commit 2022-06-18 10:44:22 -04:00
nhmall
98a4673a0c Guidebook datestamping
Allow the hints file to apply a correct timestamp to
the Guidebooks prior to use.

Detect the NH_DATESUB in the Guidebook.mn or Guidebook.tex
files and replace the datestamping line that follows.

If git is available, it determines the hash of the last commit
applied to doc/Guidebook.mn, and then determines the date of
that commit.  The interim Guidebook.dated.mn (or
Guidebook.dated.tex) gets the datestamp applied.

If git isn't available or doesn't correctly provide the hash
for doc/Guidebook.mn, it should just continue to use whatever
hard-coded date in the Guidebook.mn source file (it uses it
instead of the interim file).
2022-06-18 10:29:15 -04:00
nhmall
ab169d7961 recent changes caused a compile issue with QT
On a machine with both homebrew and macports, the presence of
macports was causing the homebrew Qt settings to be overwritten
right after they were set. Check to see if QTDIR is already
defined before proceeding with QT macports.
2022-06-15 22:22:15 -04:00
nhmall
ef0620eadd remove a couple of debugging-output lines in macOS.370 2022-06-15 19:17:30 -04:00
nhmall
3c9fa6d9d6 another macOS.370 hint tweak 2022-06-15 19:07:28 -04:00
nhmall
1f2033562d correct some conditional code in hints macOS.370 2022-06-15 18:58:44 -04:00
nhmall
57390a7b2c more macOS.370 ncurses tinkering 2022-06-15 18:34:47 -04:00
nhmall
f3dc168366 some macports updates
if macports is detected:
- check for ncurses from macports
- adjust the library search path to include /opt/local/lib
- adjust the C compiler include search path to include /opt/local/include
  via -I/opt/local/include.
- if libncursesw* is in /opt/local/lib, link with it.

Also, USEMACPORTS=1 will use macports if you have both homebrew and macports.
It isn't required, but the ordering in the Makefile will use homebrew first
otherwise.
2022-06-15 16:00:13 -04:00
nhmall
ca3e406601 some Qt6 Makefile tinkering
Adjust for a package available on ubuntu jammy jellyfish 22.04 LTS,
but one that doesn't seem to follow the norm.
2022-06-12 11:59:34 -04:00
nhmall
828de37450 suppress warnings during vs 3rd party x64 builds
These warning are in 3rd party library builds (one
in Lua relating to padding due to alignment), and
a few in pdcurses. We won't be addressing the code
in  those.
2022-06-09 20:02:19 -04:00
nhmall
e2e3c1f8de Re: [NetHack/NetHack] Prompts can overwrite copyright notice on the
starting screen (Issue #783)

On 2022-06-01 12:22 p.m., NetSysFire wrote:
> Steps to reproduce:
>
>1. Get any prompt and answer it. In my case it was a horribly old
>   save I forgot about or when I wiztested something and forgot
>   about that save, too.
>2. See that the copyright information got overwritten by the prompt:
>
>There is already a game in progress under your name. Destroy old game? [yn] (n)
>         By Stichting Mathematisch Centrum and M. Stephenson.
>         Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>         See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Expected behavior:
>
> Redraw after a prompt was answered, so the prompt vanishes and the
> entirety of the starting screen will be shown.
>
> NetHack, Copyright 1985-2022
>          By Stichting Mathematisch Centrum and M. Stephenson.
>          Version 3.7.0-59 Unix Work-in-progress, built May 31 2022 12:28:31.
>          See license for details.
>
>
> Shall I pick character's race, role, gender and alignment for you? [ynaq]
>
> Proposed severity: low. Not gamebreaking, it is cosmetic only and does
> not have any other consequences.
>

The Copyright notice is placed by tty internal routines writing onto
the BASE_WINDOW fairly early in the startup sequence.

The prompt to "Destroy old game? [yn] (n)" is using the in-game
routine to write to the message window at the top of the screen and
prompt there, just like in-game prompts and messages.

If the player answered 'y' to that, the prompt for
"Shall I pick character's race, role, gender and alignment..."
appeared immediately after. That one, however, is written using
the BASE_WINDOW routines in tty, like the copyright notice.

This change does the following:

It moves the copyright lines down a little bit leaving room for the
"Destroy.." prompts.

It places the "Shall I pick characters's..." prompt further down the
screen by default, leaving some room for about 3 raw_print startup
messages after the copyright notice, just in case there are any.
The "Shall I pick character's..." prompt will still appear immediately
if there is a prompt such as "Destroy old game?..."

There were a couple of other issues around raw_print startup messages
too. Those are delivered using a raw_print mechanism to ensure they
are written even if the window-port is not fully operational. However,
they were only on the screen for the blink of an eye. This call
sequence in restore.c made them disappear almost immediately:
     docrt() -> cls()

Put in a mechanism to detect the presence of raw_print messages
from the early startup, and if there were some, wait for a
keypress before obliterating the unread notifications.
2022-06-08 23:41:45 -04:00
nhmall
fc0bb9631a synchronize some recent changes between linux.370 and macOS.370 2022-06-03 21:26:21 -04:00
PatR
b4a415848d curses locale.h fix 2022-06-03 13:12:27 -07:00
PatR
4c47b7f622 'make depend' update 2022-06-03 13:02:40 -07:00
nhmall
57cfd7e7ed another ncursesw follow-up 2022-06-02 17:14:42 -04:00
nhmall
168ee4c9a8 yet another follow-up for linux.370 ncursesw 2022-06-02 16:31:30 -04:00
nhmall
7b1528707b another follow-up for ncursesw and CURSES_UNICODE
Don't define CURSES_UNICODE without ncursesw being available
2022-06-02 15:26:48 -04:00
nhmall
ae1f5b8d2a follow-up on linux.370 ncursesw 2022-06-02 15:10:15 -04:00
nhmall
62014be6f8 use ncursesw on linux for curses support of enhanced1 2022-06-02 14:43:46 -04:00