Commit Graph

2374 Commits

Author SHA1 Message Date
PatR
d6bff63025 X11 comment thinko
Fix a phrasing mistake that was introduced when unmatched apostrophies
were removed from the sample NetHack.ad file.
2026-03-08 03:17:42 -07:00
Pasi Kallinen
0dac2b5fa0 TTY: add support for the palette config option
For now, terminal colors are not reset back when exiting NetHack.
Depends on CHANGE_COLOR compile-time option.
2025-12-30 19:26:07 +02:00
nhmall
b3db46fd71 clear up some warnings in win/win32/NetHackW.c 2025-11-23 09:40:39 -05:00
nhmall
d5658018ac alternative to display_inventory for window-port
Several window ports that support perm_invent were
using a call back to the core display_inventory()
function.

While calling from the window port back to core functions
is arguably not ideal in the first place, it was recently
brought to light that code NetHack-3.7 code changes to
display_inventory() actually caused it to stop repopulating
the perm_invent window as intended under certain circumstances.

For now, provide an alternative function, repopulate_perminvent(),
that hopefullshould still work the way it did previously.

There will likely be some additional changes after this to
further improve things, at some point.

For now though, this
Resolves #1454
2025-11-08 14:26:07 -05:00
nhmall
60e2598d81 SYMBOLS=S_ghost:
Resolves #1448
2025-10-05 22:10:34 -04:00
nhmall
a3b60ba36f build bit for CROSS_TO_WASM=1
../win/shim/winshim.c:194:23: error: unused parameter 'wri' [-Werror,-Wunused-parameter]
  194 |     win_request_info *wri) {
      |                       ^
1 error generated.
2025-10-03 10:00:48 -04:00
nhmall
d5d40b322c fix broken Windows GUI ascii mode text color
Issue identified in
https://github.com/NetHack/NetHack/issues/1359

Resolves #1359
2025-09-05 16:38:56 -04:00
nhmall
6c3e70ad77 remove stray tabs from *.c files and config.h 2025-08-19 08:35:39 -04:00
nhmall
070730d845 Qt6 wasn't exiting as expected after saving the game
Reported by email to devteam on Feb 1, 2025.
2025-08-17 01:33:24 -04:00
nhmall
b876381b72 add support for [[maybe_unused]] if available 2025-08-07 21:47:40 -04:00
nhmall
93803de413 work around an X11 build issue under C23 2025-08-07 21:41:25 -04:00
nhmall
dcef128290 control-v on curses using pdcursesmod 2025-07-13 23:46:50 -04:00
Pasi Kallinen
e240efa10b Restoring a game can return to the wishing prompt
In TTY or curses, if the terminal goes away while you're in the wishing
prompt, return to the prompt when the game is restored.

Breaks saves.
2025-07-12 18:21:12 +03:00
nhmall
fed5be6943 another follow-up bit for X11 2025-06-30 09:21:17 -04:00
nhmall
1ece615eb2 fixes3-7-0.txt catch-up; also replace some magic hex numbers 2025-06-30 09:04:41 -04:00
nhmall
a93397e286 follow-up bit
This may not be required, but it won't hurt.
2025-06-29 20:43:28 -04:00
nhmall
459a339a95 X11: strip extra bits off color when used as index 2025-06-29 13:31:02 -04:00
PatR
02885dfccf X11 xrdb complaints
Three instances of "'s" were triggering warnings due to unmatched
apostrophe in the X11 application defaults file.  Reword the affected
comments.
2025-06-21 22:16:35 -07:00
nhmall
50e5715ca5 fix X11 warning with gcc-15
../win/X11/winX.c: In function ‘init_standard_windows’:
../win/X11/winX.c:2769:46: warning: passing argument 2 of ‘XtAppSetErrorHandler’ makes ‘__attribute__((noreturn))’ qualified function pointer from unqualified [-Wdiscarded-qualifiers]
 2769 |     (void) XtAppSetErrorHandler(app_context, X11_error_handler);
      |                                              ^~~~~~~~~~~~~~~~~
In file included from ../win/X11/winX.c:27:
/usr/include/X11/Intrinsic.h:1771:5: note: expected ‘__attribute__((noreturn)) void (*)(char *)’ but argument is of type ‘void (*)(char *)’
 1771 |     XtErrorHandler      /* handler */ _X_NORETURN
      |     ^
2025-05-30 21:17:07 -04:00
nhmall
8ac31b24f6 libnh build
The macOS.370 has not yet been tested, but it is patterned after
the linux.370 changes.
2025-05-12 08:45:26 -04:00
PatR
a587ccaa26 merge new use_menu_glyphs option with menu_objsyms
The two options are very similar but probably mutually exclusive
except when using look-here and look-into-container (both via ':')
with the default setting for 'sortloot', or with inventory when
'sortpack' has been toggled off.

This removes 'use_menu_glyphs' and changes 'menu_objsyms' from a
boolean to a compound taking six possible values:
| 0: no object symbols in menus,
| 1: append object class symbol to object header lines (same as old
|menu_objsyms boolean),
| 2: include object symbol in menu entry lines for objects (same as
|recently added use_menu_glyphs),
| 3: both 1 and 2,
| 4: display as #2 but only if the menu lacks class header lines,
| 5: if header lines are present, display as #1; if headers are not
|present, then display as #4 (which will implicitly be #2).
Default is #4.

Effectively replaces the options portion of pull request #1406 and
retains the functionality, but not as default for normal menus.

Guidebook.tex is only partially updated.  Someone else will need to
finish that.
2025-04-28 18:12:02 -07:00
PatR
ba4f90eefb PR #1406 = use_menu_glyphs for curses and tty
Pull request from NullCGT:  add 'use_menu_glyphs' option to be able
show the object class symbol in menus of objects.
tty:
|a ? scroll of identify  (instead of 'a - scroll of identify'),
curses:
| a) ? scroll of identify  (instead of ' a) scroll of identify').

This commit fixes a bit of formatting in wintty.c.

Closes #1406
2025-04-26 12:50:48 -07:00
Kestrel
9e1e032ea8 use_menu_glyphs 2025-04-26 12:50:18 -07:00
PatR
e21a5c6ac3 curses band-aid
heaputil reported an attempt to free a null pointer at line 1314 of
cursdial.c (in menu_display_page()).

curses_break_str() can return Null but its callers aren't prepared
for that.  Make it return an empty string that can be passed to
free() instead.
2025-04-20 14:19:40 -07:00
nhmall
932f598689 follow-up bit 2025-04-13 12:23:09 -04:00
nhmall
a70db6dafb WIN_MAP==WIN_ERR on a code path to tty_wait_synch 2025-04-13 12:14:38 -04:00
disperse
c271f878f9 Fixed tile numbering in objects.txt 2025-04-09 19:46:05 +03:00
disperse
b5768d676c Added tile for silver mace
Copied the mace tile and added more blue and white and softened the
shadows on the head of the mace.
2025-04-09 19:46:05 +03:00
PatR
858bf3b30d analysis lint for tilemap.c 2025-01-23 20:15:40 -08:00
PatR
6ac0be46f6 last analyzer bit for win/curses/cursmesg.c
I got confused and thought that this one (actually pair) was more
complicated than it actually is.  have_mixed_leadin is used in an
ordinary way, but resetting it to false happens in spots where it
can't be used again.  The analyzer complains that the assignments
don't do anything useful.
2025-01-23 17:30:27 -08:00
nhmall
349f3871be preproc fix 2025-01-23 19:37:19 -05:00
PatR
150b331189 analyzer lint for win/curses/*.c
There is still an issue in cursmesg.c.

The last diff band (curses_putch) isn't related to static analysis.
2025-01-23 13:52:19 -08:00
PatR
29f7580fc1 analyzer lint for sys/unix/*.c sys/share/*.c win/tty/*.c
Actually only ioctl.c for sys/share.  And with all of these, only
for the conditionals used by MacOS.
2025-01-23 12:01:46 -08:00
PatR
ba8076b142 static ananlyzer issue for alloc.c
Verifying that strlen(string) isn't too long, then allocating and
copying strlen(string)+1 draws a complaint about strcpy() overflowing
its output buffer.

Not an issue for regular play, but could matter for config file and
sysconf manipulation.
2025-01-18 18:04:09 -08:00
nhmall
d2aff9a9b2 remove some xchar vestiges 2025-01-14 12:13:39 -05:00
nhmall
1b8bc6fc29 finished CI testing; put things back 2025-01-13 13:12:40 -05:00
nhmall
fd919c1560 Revert "Revert "Revert "eliminate a couple of build warnings (noticed with clang)"""
This reverts commit 6dad19a4f6.
2025-01-13 12:13:06 -05:00
nhmall
6dad19a4f6 Revert "Revert "eliminate a couple of build warnings (noticed with clang)""
This reverts commit 1a8395002f.
2025-01-13 11:48:46 -05:00
nhmall
1a8395002f Revert "eliminate a couple of build warnings (noticed with clang)"
This reverts commit 7e8a04b35a.
2025-01-13 11:47:57 -05:00
nhmall
7e8a04b35a eliminate a couple of build warnings (noticed with clang)
2025-01-12T19:08:53.4759829Z ../win/curses/cursinvt.c:191:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
2025-01-12T19:08:53.4760198Z   191 |     case KEY_RIGHT:
2025-01-12T19:08:53.4767986Z       |     ^
2025-01-12T19:08:53.4967354Z ../win/curses/cursinvt.c:191:5: note: insert '__attribute__((fallthrough));' to silence this warning
2025-01-12T19:08:53.4967860Z   191 |     case KEY_RIGHT:
2025-01-12T19:08:53.4968026Z       |     ^
2025-01-12T19:08:53.4968219Z       |     __attribute__((fallthrough));
2025-01-12T19:08:53.4968404Z ../win/curses/cursinvt.c:191:5: note: insert 'break;' to avoid fall-through
2025-01-12T19:08:53.4968583Z   191 |     case KEY_RIGHT:
2025-01-12T19:08:53.4968709Z       |     ^
2025-01-12T19:08:53.4968820Z       |     break;
2025-01-12T19:08:53.5099063Z 1 warning generated.

2025-01-12T19:08:53.8002074Z ../win/X11/winX.c:995:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
2025-01-12T19:08:53.8008155Z   995 |     case NHW_TEXT:
2025-01-12T19:08:53.8008513Z       |     ^
2025-01-12T19:08:53.8032511Z ../win/X11/winX.c:995:5: note: insert '__attribute__((fallthrough));' to silence this warning
2025-01-12T19:08:53.8032899Z   995 |     case NHW_TEXT:
2025-01-12T19:08:53.8033057Z       |     ^
2025-01-12T19:08:53.8033219Z       |     __attribute__((fallthrough));
2025-01-12T19:08:53.8033395Z ../win/X11/winX.c:995:5: note: insert 'break;' to avoid fall-through
2025-01-12T19:08:53.8033644Z   995 |     case NHW_TEXT:
2025-01-12T19:08:53.8033783Z       |     ^
2025-01-12T19:08:53.8033912Z       |     break;
2025-01-12T19:08:53.8800783Z 1 warning generated.
2025-01-13 09:36:48 -05:00
nhmall
8ee014f5d1 update credits 2025-01-12 23:57:56 -05:00
PatR
1928a3e12b get rid of trailing space in generated tile.c 2025-01-10 01:40:02 -08:00
nhmall
ffadd254d7 follow-up: missed comment and an outdated interface 2025-01-04 23:51:34 -05:00
nhmall
be5143bb74 window-port updates
Remove start_screen() and end_screen() from the
Window-port interface.

They were only ever used by tty, and there was a comment
carried to several window-ports about how they "really
should go away. They are tty-specific"

term_start_screen() and term_end_screen() are part of
terminal/NO_TERMS supporting routines now.
2025-01-04 23:38:34 -05:00
nhmall
63dfb84d00 follow-up: whitespace clean-up for wintty.c
Some tabs to spaces.

Also restore a comment that was inadvertantly deleted.
2025-01-04 19:32:06 -05:00
nhmall
37758c7e48 some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
2025-01-04 19:01:34 -05:00
nhmall
d3c57e1b42 fix reported crash of TTY_PERM_INVENT segfaulting
Options processing can be early, even before ttyDisplay is allocated.
If we find that TTY_PERM_INVENT initialization is happening too early,
just set a marker (iflags.perm_invent_pending) to try again a bit later.

The changes in win/share are just to be able to sucessfully
reproduce the original issue on Windows. It was easily reproduced
on Unix, just by building with TTY_PERM_INVENT in include/config.h
and setting OPTIONS=perm_invent in config file.
2025-01-02 11:46:15 -05:00
nhmall
45b2a6c49a more C standard progress
There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
2024-12-20 10:32:38 -05:00
nhmall
2965ce4bc5 msdos build correction
ENHANCED_SYMBOLS is defined by default in config.h.
The msdos build tried to #undef ENHANCED_SYMBOLS
in tilemap.c, but doing it in there created a mismatch
between the data struct definition for glyph_map in wintype.h
and the initializers generated in tilemap.c

Move the msdos build catch for ENHANCED_SYMBOLS to
one single place in config1.h so that the code and data agree.
2024-12-15 09:53:50 -05:00
nhmall
c7276bcf67 more MSYS2 warning clean-up 2024-12-12 22:35:38 -05:00