Commit Graph
19282 Commits
Author SHA1 Message Date
nhmall 3a892160df macOS follow-up 2026-05-18 13:07:13 -04:00
nhmall 29951cccd1 add support for optional builder-created make.prefs
Set things up so that the Makefile build will look for 'make.prefs'
at the top of the NetHack source tree.

If 'make.prefs' is present, the Makefile build will include it
just ahead of the PRE section of a hints file specified to
sys/unix/setup.sh, or practically the first thing during a
Makefile build if no hints file was specified.

The advantage of using a 'make.prefs' is that instead of putting a
series of Makefile variable value assignments on the command line
each time, like this:
    make WANT_WIN_X11=1 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 c2x=1 resp=1 update
you can, instead, put those preferences into make.prefs, like this:

# start of make.prefs
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
# end of make.prefs

Now, my make command just needs to specify a target:
    make update

The syntax for checking whether make.prefs exists, and for including
it, is GNU make, or bsd make, specific, so sys/unix/mkmkfile.sh will
insert the correct syntax for the make that is in-use when
sys/unix/setup.sh is executed.

The 'make.prefs' file isn't limited to Makefile variable assignments, and
can contain any valid make syntax for the version of make on your system,
but adding make syntax beyond Makefile variable assignment will cause
your make.prefs file to become specific to that version of make. There
are syntactical differences between GNU make and bsd make, particularly
for directives and conditional tests.

The 'make.prefs' file can potentially eliminate much/all of the manual
editing of distributed repository Makefiles or hints files that you, as
a NetHack developer or builder, might routinely carry out.
You have the option of placing your preference changes in 'make.prefs'
instead.

Related reference for .500 hints file variables:

In the NetHack source tree:
sys/unix/README.hints

On GitHub:
https://github.com/NetHack/NetHack/blob/NetHack-5.0/sys/unix/README-hints

For example, on macOS, where GNU make is being used, and I typically
set things up using the macOS.500 hints file:
    sys/unix/setup.sh sys/unix/hints/macOS.500
I might have the following make.prefs in the root of my NetHack source tree:
#---- snip -------
$(info Attention - Using make.prefs)
WANT_MACSOUND=1
resp=1
#---- end-snip ---

For another example, on Linux, where GNU make is being used, and I
typically set things up using the linux.500 hints file:
    sys/unix/setup.sh sys/unix/hints/linux.500
I might have the following make.prefs file in the root of my NetHack
source tree:
#---- snip -------
$(info Using make.prefs)
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
#---- end-snip ---
2026-05-18 13:03:31 -04:00
nhmall d9bc6d7b8a Revert "add #-EARLY section"
This reverts commit 85ca1cce74.
2026-05-17 20:54:08 -04:00
nhmall 85ca1cce74 add #-EARLY section 2026-05-17 20:38:10 -04:00
nhmall 8ce430bd89 put the values on other pdcurses platforms back
They were set this way on other pdcurses platforms prior
to this recent change, so leave them at those values.
2026-05-16 22:13:40 -04:00
nhmall 125800404b fixes5-0-1.txt catch-up 2026-05-16 21:45:30 -04:00
nhmall 51011e234d build fix attempt for msdos cross-compile
Recent change was #ifdef PDCURSES, but that is
also used on msdos and other platforms
2026-05-16 21:41:05 -04:00
nhmall 476d0717a7 CI NetHack version 2026-05-16 21:02:38 -04:00
nhmall 083e55e905 Windows curses-related follow-up 2026-05-16 12:22:03 -04:00
nhmall d78a875110 more Windows curses size tinkering 2026-05-16 12:15:20 -04:00
nhmall b2458e679a recently-appeared warning bit
mkroom.c(598): warning C4389: '!=': signed/unsigned mismatch
2026-05-16 11:37:51 -04:00
nhmall 4434b14884 more hints file readiness in Makefiles 2026-05-16 10:59:48 -04:00
Pasi Kallinen 5199921c05 Fix experience-level up/down hilighting
The highlighting worked correctly for #levelchange in wizard mode,
but not for gaining experience levels by killing monsters.
2026-05-16 16:51:34 +03:00
nhmall e1ee404ecc warning workaround led to a build error on some platforms & compilers
Use another method for the warning workaround.

allmain.c:33:56: error: 'maybe_unused' attribute cannot be applied to types
   33 | early_init(int argc USED_FOR_CRASHREPORT, char *argv[] USED_FOR_CRASHREPORT)
      |                                                        ^
allmain.c:28:30: note: expanded from macro 'USED_FOR_CRASHREPORT'
   28 | #define USED_FOR_CRASHREPORT UNUSED
      |                              ^
../include/tradstdc.h:510:16: note: expanded from macro 'UNUSED'
  510 | #define UNUSED ATTRUNUSED
      |                ^
../include/tradstdc.h:397:22: note: expanded from macro 'ATTRUNUSED'
  397 | #define ATTRUNUSED [[maybe_unused]]
      |                      ^
allmain.c:33:49: warning: unused parameter 'argv' [-Wunused-parameter]
   33 | early_init(int argc USED_FOR_CRASHREPORT, char *argv[] USED_FOR_CRASHREPORT)
      |                                                 ^
1 warning and 1 error generated.
2026-05-16 09:05:29 -04:00
nhmall 2445b97a10 build fix with hints file linux.500 and musl=1
This fix was suggested by @PPN-SD in the comments on
GitHub issue https://github.com/NetHack/NetHack/issues/1530#issuecomment-4466027729

Resolves #1530
2026-05-16 08:57:54 -04:00
Pasi Kallinen 0f0e7c99bf Fix random attended shrines in irregular rooms 2026-05-16 14:57:12 +03:00
nhmall a8f97a3926 OpenBSD build bits
An issue still remains with fetch-Lua in the top Makefile.
2026-05-15 21:58:51 -04:00
Patric Mueller 3a0c6f17c7 fix buffer overflow in update_topl
Buffer overflows could occur when interacting with containers while
inputting or outputting many items.

This commit ensures topline updates do not exceed buffer limits by
checking against TBUFSZ.

Issue reported by k21971 on IRC.
2026-05-15 23:32:14 +02:00
PatR e11ff5f703 another try at removing static analyzer complaints
The one in options hasn't been addressed this time.
2026-05-15 13:40:34 -07:00
nhmall c558ef0b33 Makefile syntax did not work on OpenBSD
Trying another approach for whichbsd.500
2026-05-15 15:29:25 -04:00
Pasi Kallinen a533350537 TTY: allow custom glyph colors on more limited terminals
Previously changing glyph colors required a terminal with more
than 256 colors, even if the color was one of the basic 16 colors
used by NetHack.
2026-05-15 20:21:52 +03:00
nhw_cron e05864544c This is cron-daily v1-May-7-2026. 000files updated: Files 2026-05-15 12:25:20 -04:00
nhmall d81d47b81e new file header info 2026-05-15 12:18:29 -04:00
nhmall 8d0cfb05fa rename netbsd.500 to bsd.500
In past releases of NetHack, there was a myriad of different hints
files for different operating systems, and even different versions
of operating systems.

It made maintenance a chore, because all the variable hints files
had to be updated for a wanted change, or (as typically was the
case), some lesser-used hints files were left behind and became
outdated.

Instead of going down that road again, this renames
    sys/unix/hints/netbsd.500
to
    sys/unix/hints/bsd.500

Where things need to differ for a different bsd flavour,
the differences can be shrouded in things like

    .if ${WHICHBSD} == "NETBSD"
    .else
    .endif

This change is being done to make maintenance easier, at the
cost of making the resulting Makefiles a little more complex,
but there won't be as many separate Makefile hints to maintain.

This commit is being done instead of merging pull request #1531
which would add a new sys/unix/hints/openbsd.500 file.

Only tested on NetBSD so far. Please let us know if there's
an issue on other bsd's, and we will attempt to fix thos issues.

Closes #1531

Close
2026-05-15 12:11:34 -04:00
PatR 9ec26da4ff static analysis fix attempt
These three changes compile but I don't know whether thay succeed in
suppressing the new static analyzer complaints.
2026-05-15 08:11:56 -07:00
nhmall 99f559fe18 utilize more real estate on Windows GUI curses
Some inventory items were being hidden in a lengthy list.
2026-05-15 01:21:45 -04:00
nhmall accb14b797 free up some console alloc()'d memory under curses
tty takes care of this, but it wasn't being done under curses
2026-05-14 23:57:25 -04:00
nhmall 5edb093e14 pdcurses: don't truncate curses window width
The curses windows were being capped at 110 columns
inappropriately.

Use the full width of the console.
2026-05-14 22:40:48 -04:00
nhmall 2eb817af07 OS bit in sp_lev.c 2026-05-14 13:03:48 -04:00
PatR c6a58c5c5a warning fix 2026-05-14 08:48:19 -07:00
Pasi Kallinen f000fed16d Fix statue and figurine genders in special levels
When a random statue or a figurine was generated in special levels,
the gender was not initialized correctly, so you ended up getting
eg. "dwarf ruler"

It now works correctly, and you can still specifically request
a non-gendered version with the montype-parameter.

For example

des.object({ id = "statue" });
des.object({ id = "statue", montype = "dwarf ruler" });
2026-05-14 17:38:29 +03:00
nhmall 342bbc85c4 warning bit for clang-22 and tiletext.c 2026-05-14 08:31:33 -04:00
nhmall 7e50882ffb Files updated from cron daily 2026-05-14 07:29:02 -04:00
nhmall bc20ccd659 README wording bit 2026-05-13 20:38:52 -04:00
nhmall 11cd021063 update header info on netbsd.500 2026-05-13 17:34:46 -04:00
Pasi Kallinen 17f5642faf Obey statue type gender
The gnome king statue in minetn-5 was generated as a gnome leader,
obey the gender of the statue name, so generating a statue of
for example "gnome king" and "gnome queen" works correctly.
2026-05-13 23:08:27 +03:00
Anthony C Howe afeb2f55c9 bsd build support
Originating from https://github.com/NetHack/NetHack/pull/1519,
there was an issue with the pull request's back-end fork or with
the pull request itself.

The code changes were applied manually instead, with credit to the
pull request's author, instead of being directly merged in via the
pull request.

Contributed by @SirWumpus on GitHub.

Also,
- fixed a bit of conditional code in include/unixconf.h, where the
  #else clause remained out of reach for non-bsd systems, but was
  needed..
- added a disclaimer to the contributed sys/unix/hints/netbsd.500.
2026-05-13 12:49:45 -04:00
nhmall 46ab1ae213 follow-up: remove previous line 2026-05-13 12:43:15 -04:00
nhmall b9da5b7ced update tested versions of Visual Studio 2026-05-13 2026-05-13 12:40:12 -04:00
nhmall b17392a985 innocuous commit 2026-05-13 11:39:40 -04:00
nhmall 17ae931003 fixes5-0-1.txt catch-up 2026-05-12 19:08:44 -04:00
nhmall 1b1beaa5bb spelling correction 2026-05-12 18:00:39 -04:00
nhmall 82d7b2b249 Merge branch 'cleanup-followup' of https://github.com/ingpaschke/NetHack into NetHack-5.0 2026-05-12 12:46:25 -04:00
nhmall e0ccf22d84 One of our TeX tools leaves .out files behind 2026-05-12 12:44:26 -04:00
Ingo Paschke 6736f878aa Amiga: graphical tombstone RTG-screen fallback
amii_outrip relies on LoadRGB4/transpalette fade and raw BltBitMap
to a SMART_REFRESH window -- chipset-era idioms that do not reach
the visible display on Picasso96 or CyberGraphX screens.  On RTG
the screen stayed black and the user saw nothing between the
death messages and the high-score list.  Detect RTG by screen
size > 800x600 and fall through to genl_outrip so RTG users get
the ASCII tombstone instead.

Switch the still-graphical path to BltBitMapRastPort so the blit
goes through the layer system, and move CloseWindow(ripwin)
outside the Forbid()/Permit() pair (same fix as amii_cleanup).

Rename cmap_white/cmap_black to cmap_outline/cmap_fill -- those
variables actually hold the indices of the darkest and lightest
palette entries, used for the four offset outline strokes and
the centered fill stroke respectively; the old names were
backwards.
2026-05-12 15:33:29 +02:00
Ingo Paschke 89971a5fc9 Amiga: fix extended-command menu mouse-pick
The amii_get_ext_cmd menu used the first character of each command
as the item identity (id.a_char) and then linearly searched
extcmdlist for the first command starting with that character.
Many commands share a first letter, so picking #airlevel returned
#adjust, #wipe returned #wear, etc.  Store the actual index in
id.a_int and read it back directly.

While in that function, size obufp at BUFSZ (was 100) and replace
the unbounded strcpy from extcmdlist[i].ef_txt with strncpy +
explicit NUL.
2026-05-12 15:31:44 +02:00
Ingo Paschke 146fbf20d8 Amiga: clamp amii_numcolors and guard tile CMAP loop
Reject tile/tomb IFF files whose nPlanes field exceeds DEPTH:
the CMAP loop writes 1<<np entries into amii_initmap[] /
amiv_init_map[], both sized AMII_MAXCOLORS = 1<<DEPTH = 64, so
a malformed file with nPlanes >= 7 would corrupt adjacent BSS.

After OpenScreen succeeds, clamp amii_numcolors to the actually
populated portion of the init-map arrays (AMII_PALETTE_SIZE for
text mode, AMIV_PALETTE_SIZE for tile mode).  On a 64-color
screen this stops LoadRGB4 from loading the zero-initialized
tail entries as black.  Replace the matching magic 32 in the
tilefile selection with AMIV_PALETTE_SIZE.

While there, add the (char) cast on amii_glyph_buffer's
truncating assignment to make the contract explicit.
2026-05-12 15:30:48 +02:00
Ingo Paschke 459113a48e Amiga: fix --more-- infinite loop on overlong words
When a single word exceeds the visible message-window width the
wrap loop found no whitespace, called outmore(cw), and continued
without advancing str -- and on the next iteration curx==0 took
it straight back to the same spot.  Force-break the word at the
column boundary when we are already at the start of a line.

Also reset the wrapping static flag to 0 after the NHW_BASE wrap
cleanup runs, so the cleanup fires once after a wrap instead of
on every subsequent putstr.
2026-05-12 15:29:37 +02:00
Ingo Paschke 4e63ba90ca Amiga: bound BufferQueueChar; move CloseWindow out of Forbid()
Make the BufferQueueChar macro bounds-check KbdBuffered against
KBDBUFFER internally so the RAWKEY and NEWSIZE 'R'-64 paths can
no longer push past the 10-byte queue; widen KbdBuffered to int
so the counter cannot wrap silently in the queue-scan loops.

In amii_cleanup move kill_nhwindows()/DeleteMsgPort() outside
the Forbid()/Permit() pair: CloseWindow can wait on layers.library
semaphores on OS 3.x and that is unsafe under Forbid.  Keep only
the IDCMP-flush loop inside.
2026-05-12 15:28:43 +02:00
Ingo Paschke 252ca5bef7 Amiga: defensive NULL/bounds guards in menus and window creation
Guard the gd lookup in DoMenuScroll's GADGETUP/MOUSEMOVE branches
so a window with no GadgetID==1 does not deref NULL; match the
existing guards in the keyboard-scroll branches.  In the keyboard
selector and MENU_UNSELECT_ALL paths, only mutate items with
canselect set so a non-selectable header cannot have its str
stomped.  Clamp MENU_LAST_PAGE topidx to >= 0.  Make find_menu_item
return NULL on negative idx instead of the head item.  Guard the
PROMPTFIRST data[] shuffle behind cury > 0.

In amii_destroy_nhwindow's NHW_OVER branch use cw->win with a NULL
guard instead of dereferencing amii_wins[WIN_OVER]->win blindly.
Range-check the type argument to amii_create_nhwindow.  Fix the
*argv_in[1] precedence bug so the -L/-l flag does not deref NULL
when it is the last argument.  Wrap AllocAslRequest result in a
NULL check before AslRequestTags/FreeAslRequest.

Defensively bounds-check the idx argument to DispCol.  Replace
the -25937 signed-int literal in clipwin's PropInfo with the
equivalent UWORD value 39599.  Simplify amii_start_menu's free
loop; switch DoMenuScroll's inventory title and Count display to
Snprintf, and stop passing countString to pline as a format.
2026-05-12 15:27:13 +02:00