Commit Graph
19282 Commits
Author SHA1 Message Date
Pasi Kallinen 4fadc7c96f Fix qt compile
Some recent Makefile hints reorg messed with the Qt compile,
it needs to be linked tiles
2026-06-03 10:54:16 +03:00
nhmall 0aba284106 better placement for ensuring graving vanishes
This is better placement for making the original
engraving vanish when told that it vanishes;
helps to ensure that it isn't showing for any
next steps.

also, a warning bit
2026-06-02 09:34:52 -04:00
nhmall 29c300b4e0 stale engraving marker still showing at prompt 2026-06-01 20:44:17 -04:00
nhmall a31a9cb152 Makefile.nmake updates for git_sha 2026-05-31 18:28:06 -04:00
nhmall c112e50afe follow-up: indentation bit 2026-05-31 13:57:56 -04:00
nhmall ef48aa3c18 Merge branch 'fix-libnh-glyphpiletop-constant' of https://github.com/avgas3/NetHack into NetHack-5.0 2026-05-31 13:46:23 -04:00
nhmall 055caaffbf revisit shop_keeper() readiness
During a restore from a savefiles is not the only
time that levels are processed by getlev() in NetHack.
They are read back in as the hero moves up and down
between levels and dungeons.

The previous fix checked for program_state.beyond_savefile_load,
but once set, that remains static through level changes.

It would be better to check the status of the level
being read, because those operations do placements as well.

Add the following:
    struct levelstatus level_status;
    level_status.making   - in the midst of makelevel processing
    level_status.loading  - in the midst of loading a level via getlev()
    level_status.ready    - the level is fully ready

    (all 3 of the above status settings are mutually exclusive)

    level_status.shkready - the level processing is far enough
                            along to allow shop keeper tests and actions

This also relocates the find_lev_obj() call in getlev() down several
lines, so that it falls after any set_residency() calls, so that it
has a better chance of carrying out what it was intending to do with
the shop_keeper() checks made by its subfunctions.
2026-05-31 13:26:34 -04:00
Housebot 3096da48fe libnh: export GLYPH_PILETOP_OFF constant
Expose GLYPH_PILETOP_OFF in libnh JS constants so embedding apps
can distinguish statue glyphs from piletop glyphs.
2026-05-31 11:21:25 -06:00
nhmall f72554a238 avoid shk interaction too early 2026-05-30 15:54:18 -04:00
nhmall b6b35a8d0f yet-another fixes5-0-1.txt update 2026-05-30 11:48:31 -04:00
nhmall 13ff430b14 Alter the fixes5-0-1.txt entry to match code 2026-05-30 11:45:20 -04:00
nhmall 78e7b23b1e follow-up: Unix uses different code; build fix 2026-05-30 11:40:54 -04:00
nhmall bb407a84da follow-up: fixes5-0-1.txt entry re:previous commit 2026-05-30 11:38:38 -04:00
nhmall 2a912fe001 SELECTSAVE update
In SELECTSAVE implementations, out of date savefiles in the
tree were triggering error messages to the user during the
building of the pick list. The file with the error never
ended up on the pick list, or got removed, so the error was
perpetual on every SELECTSAVE startup.

This passes the UTD_QUIETLY flag down the the small set of
callers involved, so that when it was received by uptodate(),
it went about its verification work quietly.
2026-05-30 11:32:37 -04:00
nhmall e82a1f3276 Merge branch 'glyphs-fixes-take2' of https://github.com/ingpaschke/NetHack into pr1559 2026-05-30 08:12:32 -04:00
Patric Mueller 207db14301 tty: handle indexed colors separately from RGB color space
The terminfo entries from the standard ncurses distribution have
peculiar settings for entries supporting 24 bit colors. The direct
entries mix indexed and RGB values into an incompatible mess.

This commit adds a simple workaround for the tty port.  Colors are
initialised as if only 8 ANSI colors are available.  This does not
affect color customisation from the symsets.

The curses port is affected as well. But I am not yet comfortable to
refactor a large part of the code for an absolute edge case.
2026-05-30 13:53:13 +02:00
nhw_cron a24a0240ce This is cron-daily v1-May-7-2026. 000files updated: Files 2026-05-29 15:40:37 -04:00
nhw_cron 526ffaa582 This is cron-daily v1-May-7-2026. 005guidebook updated: doc/Guidebook.txt 2026-05-29 15:40:22 -04:00
nhmall 0c7070037d yet another Guidebook follow-up 2026-05-29 06:42:39 -04:00
nhmall d676206200 follow-up bit Contributing.md 2026-05-29 06:31:01 -04:00
nhmall 898a430617 follow-up bits for Guidebook.mn processing 2026-05-29 06:27:02 -04:00
nhmall 942f34c883 fix file name in header line 2026-05-28 21:11:38 -04:00
nhmall 287d3f60b5 tone down header lines on GitHub Contributing pg 2026-05-28 21:06:39 -04:00
nhmall 883620699f Guidebook.txt update
Created from make. The cron repo did not have today's updates.
2026-05-28 17:43:02 -04:00
Ingo Paschke 5f817fe9ad glyphs: code-review fixes and parse_id off-by-one
- cmap_offset was calculated on every compose_glyph_name() call;
    calculate it once with a static function.
  - Drop parse_id's G_ auto-populate: an unbracketed lookup allocated
    the index with no matching free.  Linear-scan instead when absent.
  - compose_glyph_name: require bufsz >= BUFSZ, build names with
    bounded Snprintf instead of Strcpy/Strcat, drop the dead memchr.
  - parse_id's permonst scan used i <= pm_count, reading one past the
    SYM_MON block (S_nothing) and matching it as a monster; use <.
  - Drop a stale NO_GLYPH empty-bucket comment from the open-addressed
    table.
2026-05-28 21:08:54 +02:00
nhmall 29380dfdb9 follow-up: TeX doesn't require special handling for ']' 2026-05-28 11:32:06 -04:00
nhmall f47edf59c3 Guidebook update
Make it clear that the *DIR options are not available on Unix.

Related to discussion on GitHub Issue #1552
2026-05-28 11:17:46 -04:00
nhmall a9401fd78a Guidebook bits for Jon Wätte (Jon W{tte)
There is no unintentional spelling mistake.
Close #1523
2026-05-27 23:02:19 -04:00
nhmall 6c950d958f util project needed strutil.c and alloc.c
It was using dupstr(), so strutil had to be added to the project.
2026-05-27 20:58:29 -04:00
nhmall 4e80fda312 build fix for util 2026-05-27 20:51:51 -04:00
nhmall f88d410ba2 typos 2026-05-27 20:14:50 -04:00
nhmall 38d8d2972d README 3.6 vestige 2026-05-27 20:05:59 -04:00
nhmall 0bf0498155 add dirs-perms.500 and a default build change
The directories and permissions portion of the linux.500 and macOS.500
hints files and their included files has been consolidated to
dirs-perms.500.

The builder can edit that one file now, to identify
the folders that will be utilised as part of the build.

Alternatively, you can set those folders and permissions in a
make.perms file in the top of the NetHack folder tree and
they should take precedence over the ones in dirs-perms.500
because dirs-perms.500 uses '?=' variable assignment, which
means "set the value of the variable if no value has been set."

* NOTE: BUILD CHANGE *

This also makes WANT_SOURCE_INSTALL=1 the default over
WANT_SHARED_INSTALL=1, if neither is explicitly set.
The new default is the safer and less-impacting default,
but it will change where things get installed over earlier
Makefile builds. You can be explicit with WANT_SHARED_INSTALL=1
in your make command to get that..

These are the differences between the two:

make WANT_SHARED_INSTALL=1    Place the results of the install/update portion
                              of the build into a shared area on a multiuser
                              system.

make WANT_SOURCE_INSTALL=1    Place the results of the install/update portion
                              of the build into a subfolder of the source
                              tree, rather than in a system-wide shared area.

Also note that the macOS hints file behaves slightly differntly depending
on whether WANT_SOURCE_INSTALL=1 was set versus letting it be the default.
That's not new, it behaved that way before.
2026-05-27 19:32:40 -04:00
nhmall 5d2dc1c85e update tested versions of Visual Studio 2026-05-27 2026-05-27 19:25:11 -04:00
nhw_cron e31a104542 This is cron-daily v1-May-7-2026. 000files updated: Files 2026-05-27 17:49:25 -04:00
nhmall 94d3946ef1 follow-up: fix a couple of paste errors 2026-05-27 17:09:43 -04:00
nhmall d7d0e9061a follow-up: trailing whitespace 2026-05-27 16:44:51 -04:00
nhmall ce31feb231 add some foundational work for uplifts
Be able to carry out uplifts during minor release
lifetimes.

Document a way to be able to uplift struct content
without incrementing EDITLEVEL and breaking existing savefiles.
Use the mechanics outlined to uplift the contents instead, where
it is feasible to do so. The uplift is currently one-way only. An
uplifted savefile cannot be used with an earlier build of NetHack
, one built with a lower SAVEFILE_REVISION_LEVEL, than the one which
wrote the savefile.

The final byte (byte 79) of the 80 critical bytes in the savefile,
of which 10 are reserved for future expansion and not currently
used, will now be used for holding the savefile revision level
(SAVEFILE_REVISION_LEVEL in include/patchlevel.h) at the time
the savefile was written.

That leaves 9 of the bytes available for future use.
2026-05-27 16:14:20 -04:00
nhmall e352048612 include MAXTCHARS in --dumpenums 2026-05-26 22:00:12 -04:00
Ingo Paschke 598253eac8 glyphs: rotate-5 in glyph_hash eliminates true collisions
The previous rotate-1-xor put consecutive characters' bits in
adjacent positions, so short similar names like fox/bat or
jaguar/lichen collided -- 164 colliding buckets across the 9577
named glyphs.  Rotate-5 spreads each character across a 5-bit
window: zero true collisions, one m68k ROL.L, no multiplication.

The 16 remaining same-hash buckets are name duplicates from a
separate compose_glyph_name bug, addressed by its own fix.
2026-05-25 15:45:25 -04:00
nhw_cron b4f417f2ca This is cron-daily v1-May-7-2026. 005guidebook updated: doc/Guidebook.txt 2026-05-25 15:41:24 -04:00
nhmall bd67f3d0d6 merge bit 2026-05-25 15:33:54 -04:00
nhmall fee9516d9b Merge branch 'fix-piletop-generic-obj-prefix' of https://github.com/ingpaschke/NetHack into pr1549 2026-05-25 15:30:40 -04:00
Ingo Paschke 95d70ef5d8 glyphs: add piletop_ prefix to piletop-generic-obj canonical names
parse_id's glyph_is_object branch only emitted the "piletop_" prefix
when glyph_is_normal_piletop_obj(glyph) was true.  Piletop-generic
objects (the GLYPH_OBJ_PILETOP_OFF + 1 .. + LAST_GENERIC range) hit
glyph_is_piletop_generic_obj() instead and got no prefix, so they
produced the same canonical name as their non-piletop generic
counterparts.

For example glyph 3449 (GLYPH_OBJ_OFF + GENERIC_STRANGE) and glyph
7993 (GLYPH_OBJ_PILETOP_OFF + GENERIC_STRANGE) both yielded
"G_generic_strange".  14 such pairs exist; the piletop variant is
unreachable by name from nethackrc, and the runtime hashtable's
"assume no id occurs twice" populate loop silently dropped them.

Emit "piletop_" for both piletop predicates so each glyph gets a
distinct canonical name.  --dumpglyphnames now shows the 14
"G_piletop_generic_*" entries (and the count goes from 9577 to 9591;
the existing off-by-one in glyph_is_normal_piletop_obj still hides
slot GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1, which is addressed by
its own fix).
2026-05-25 21:19:51 +02:00
nhmall 503355bb11 yet another function and date name update
Related to the overhaul of glyphname hash indices
2026-05-25 14:44:32 -04:00
nhmall 8b3eb77305 cherry-pick pr #1548 52e0404 glyphname indexes 2026-05-25 14:30:02 -04:00
Ingo Paschke be9e430ebb glyphs: replace open-addressed glyphname hashtable with sorted index
The open-addressed glyphname_hashtable stored each canonical
"G_xxx" name as a dupstr'd string in its bucket: ~9577 small heap
allocations and ~290 KB of resident name strings, on top of ~256 KB
of 32768-bucket scaffolding kept at <50% load for probe performance.
On classic Mac OS the populate cost (quadratic small-allocation in a
fragmented Memory Manager heap) dominated startup time -- many
seconds on an SE/30 -- and ~800 KB resident is meaningful on the
small machines the port targets.

Switch to a sorted (hash, glyph) index sized exactly to the number
of named glyphs:

  struct glyphname_hashtable_entry_t {
      uint32 hash;
      int glyphnum;
  };

populate_glyphname_hashtable() allocates one block of MAX_GLYPH
entries (no per-name strings), fills it via compose_glyph_name() +
glyph_hash(), and qsort()s ascending by hash.  Lookup binary-searches
the hash column, then walks any equal-hash neighbours verifying each
candidate by reconstructing its canonical name and strcmpi'ing it
back -- collisions are rare with 9577 uniformly-distributed 32-bit
hashes.

Other changes that fall out:

 * Extract compose_glyph_name() from parse_id's bulk-iteration switch
   so it is the single source of truth for "glyph number -> canonical
   name".  Called by find_glyph_in_hashtable for collision
   verification, by populate_glyphname_hashtable, by the
   --dumpglyphnames path, and by wizcustom_glyphnames.
 * empty_glyphname_hashtable() reduces to free(ptr); no per-entry
   strings to release.
 * Drop find_glyphname_in_hashtable_by_glyphnum (no longer used --
   wizcustom_glyphnames iterates compose_glyph_name directly).
 * Drop the res_fill_hashtable parse_id mode; populate iterates
   directly.

Memory drops from ~800 KB to ~75 KB.  One allocation instead of
~9578.  Lookup goes from O(1) to O(log N) but N ~ 9577 means ~14
comparisons per probe -- well under what the upstream cache ever
cost in practice.

Function names (populate_glyphname_hashtable, etc.) are kept for
extern.h compatibility; the data structure is now a sorted index,
"hashtable" in the names is historical.

--dumpglyphnames output is byte-identical.
2026-05-25 14:22:19 -04:00
nhmall b7c7f051b4 update Guidebook to refer to glyphname 2026-05-25 13:49:44 -04:00
nhmall 752af5b435 add fixes5-0-1.txt entry for pr #1547
fix off-by-one in glyph_is_normal_piletop_obj
2026-05-25 12:19:47 -04:00
Ingo Paschke 87a0bdf26c display: fix off-by-one in glyph_is_normal_piletop_obj
glyph_is_normal_object includes its boundary slot
GLYPH_OBJ_OFF + FIRST_OBJECT - 1 via >=, but its piletop sibling
glyph_is_normal_piletop_obj used > and excluded the matching
GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1 slot.  That leaves
exactly one glyph (the would-be G_piletop_generic_venom) matching
neither the piletop-generic nor the piletop-normal predicate, so
parse_id never builds a name for it and --dumpglyphnames emits a
blank line for the slot.

Change > to >= so the two ranges are inclusive on the same side.
--dumpglyphnames now produces (8009) G_piletop_generic_venom.
2026-05-25 17:06:24 +02:00