Commit Graph

14568 Commits

Author SHA1 Message Date
nhmall
9e2effe710 Merge branch 'unicode-performance' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-12-10 17:15:31 -05:00
Ray Chason
b7a56b5895 Clean up dangling pointers when freeing glyphmap
Partially fixes issue #941.
2022-12-10 17:00:28 -05:00
Ray Chason
ea84598613 Remove some debug code 2022-12-10 13:13:28 -05:00
Ray Chason
aa1d130345 Revert adding bsearch to system.h 2022-12-10 12:27:18 -05:00
Ray Chason
c7431d6942 Reimplement glyph cache as a hash table 2022-12-10 12:27:18 -05:00
Ray Chason
d5bc738812 Replace Snprintf with faster Strcpy 2022-12-10 12:27:18 -05:00
Ray Chason
b9ef6e6bb9 Define a tail pointer for the glyph list
Use the tail pointer to add new glyphs, avoiding the need to traverse
the list.
2022-12-10 12:27:18 -05:00
Ray Chason
e556af78ec Use pointer assignments to generate glyph names 2022-12-10 12:25:56 -05:00
Ray Chason
d90cd6d7d2 Skip match_sym for G_ lines 2022-12-10 12:25:56 -05:00
Ray Chason
51ec42886e Fix -dumpglyphids on Unix
The order of the statements needs to be changed, so the -d is not
interpreted as requesting a directory.
2022-12-10 12:25:55 -05:00
Ray Chason
d70bdeab3b Fill the glyph cache when switching symbol sets 2022-12-10 12:25:55 -05:00
Ray Chason
7dc1106ec1 Sort the glyph cache and search it with bsearch
Also, recognize G_slime_mold and G_piletop_slime_mold when the fruit
has been set.
2022-12-10 12:25:55 -05:00
PatR
6a1f875b17 some extern.h reformatting
Wrap or re-wrap some wide lines.
2022-12-10 00:48:38 -08:00
PatR
7c0c0ba66a shop sanity check of the day...
If a pet picks up a no_charge item in a shop and gets teleported out,
clear that flag.  (It's already being cleared for non-pets as soon as
they pick any item up.)
2022-12-09 12:55:39 -08:00
PatR
9fa08b383f shopping objects, unpaid and no_charge, what else?
Revise sanity_check to acknowledge that buried objects might be unpaid
or no_charge.  (For unpaid, drop shop-owned object in a gap in the
shop wall or in the free spot; for no_charge, drop something the shk
doesn't care about, or drop any hero-owned item and decline to sell.
Dig a pit.  Push or drop a boulder to fill the pit.)

Change 'I' to look for unpaid objects on the floor and for buried ones
when deciding when to include 'u' in the list of candidate object
classes and pseudo-classes.

Change 'Iu' to mention buried unpaid objects as well as floor ones.
For both non-invent categories, show a combined count without cost
info.

Have sanity_check of monster inventory test for unpaid and no_charge.

When a monster (including pet) picks up an item that's marked unpaid
(so one dropped on shop boundary, not an ordinary for-sale one), take
it off hero's shopping bill.  If dropped--pet behavior or monster
death--inside the shop, it will become for-sale rather than no_charge
or back on bill.  [Removal from bill is needed to prevent an unpaid
object ending up outside the shop if a monster carries it out, and
current sanity_check complains about an unpaid item in mon->minvent.]
2022-12-09 04:18:20 -08:00
nhmall
4c32ca571a doc update 2022-12-08 10:46:36 -05:00
PatR
e335171071 no_charge sanity
When a shopkeeper becomes angry, clear the no_charge flag for all
floor objects on the level, even if they happen to be in another
shopkeeper's shop.  Should prevent sanity_check warnings if/when the
angry shk leaves the shop, and once the shk is pacified, items in
the shop that used to be available for free will become for-sale.
2022-12-08 02:36:50 -08:00
PatR
f1a471c139 some shk.c formatting 2022-12-08 01:06:09 -08:00
nhmall
873d08b7bc fix Makefile rule when building pdcurses library
Also, use Bill Gray's pdcursesmod for now.
2022-12-07 21:23:14 -05:00
PatR
4a965bbd83 boulder pushing feedback
Redo the details about giving or suppressing "with great effort you
push the boulder".  It works the same except that if push a different
boulder than previously, you'll get a new message.  If you do it
while riding, you have the same lack-of-message for successive pushes
instead of getting a message every turn.

Don't exercise strength when pushing a boulder if poly'd into a giant.
2022-12-07 16:45:35 -08:00
nhmall
3ac4e55f1f submodule update for pdcurses 2022-12-07 17:22:10 -05:00
PatR
bf5a089389 revise man page yet again
Rewrite much of the paragraph about the run-time config file.

Remove mention of '-p @' since it doesn't actually work.

Expand 'nethack -s' a bit.

Revise --showpaths.

Shuffle --scores, --version, --showpaths, and --usage into the same
order as usage feedback lists them, primarily scores first and usage
last.
2022-12-07 12:22:49 -08:00
Pasi Kallinen
85137bb76a Fix skipping attacks if hero moved away
Recent change by me caused a bug where a monster was trying
to attack after hero was moved away by the previous attacks.
2022-12-07 21:51:50 +02:00
nhmall
d18ce24320 more continuation alignment after g to g? (.h) 2022-12-07 11:31:11 -05:00
nhmall
8120b74051 realign macro continuation after g to g? expansion 2022-12-07 11:24:17 -05:00
Patric Mueller
68f9ef8aa6 Followup to "suicide by wand", remove redundant an() 2022-12-07 15:54:30 +01:00
PatR
0d4cf0323c shop wall repair vs unpaid shop goods
Take unpaid shop items off the bill if they're on the floor and
wall repair moves them from the shop boundary to all the way inside
the shop.

I don't think it's possible for items to be moved out of the shop
except for the very special case of moving into an adjacent shop
which shares the wall, so clearing no_charge for an item that is no
longer inside a shop is academic.
2022-12-07 02:02:08 -08:00
PatR
e48e08a93b topten.c comments 2022-12-06 17:41:44 -08:00
PatR
f52a8e48b1 suicide by wand
If hero zaps self with a wand and the result is fatal, report the
death as "zapped himself with <a wand of sometype>" rather than just
"zapped himself with a wand".
2022-12-06 11:41:24 -08:00
PatR
e724034995 unpaid sanity_check: leaving shop via recoil
Throwing while levitating or getting hit for knockback effect could
move hero carrying unpaid items out of a shop.  If that happened,
sanity_check complained that unpaid items weren't in a tended shop.

Check for entering and leaving special rooms during recoil same as
gets done for ordinary movement.  Leaving a shop via recoil or
knockback while owing a bill now gets treated as robbery immediately
rather than waiting until hero voluntarily moves to another spot
after recoil has finished.
2022-12-06 10:57:14 -08:00
nhmall
f61a862a47 paste error in Makefile.mingw32 2022-12-06 11:00:29 -05:00
PatR
2b5ed0b6b9 trap.h formatting
I don't know whether we'll ever run the code through clang-format
again, but in case we do, end-of-line comments which span lines
should begin continuation lines with '*', otherwise they get turned
into block comments beginning on the next line.

|code; /* start
|         end */
gets changed to
|code;
|/* start end */

but
|code; /* start
|       * end */
stays as-is.
2022-12-06 00:49:52 -08:00
PatR
25de3d2247 usage typo/thinko 2022-12-05 23:24:18 -08:00
PatR
20392a68fd yet more shop sanity checking
Reconcile boulder pushing with no_charge sanity checking.  The hack.c
part comes from entrez.

Pushing a for-sale boulder from inside the shop to the shop's boundary
("free spot", doorway, or gap in wall) adds it to the shop bill even
though it's still on the floor.  Leaving the shop without paying for
it is a robbery.  Also, pushing an unpaid boulder that's on the shop
boundary to any spot that's all the way outside the shop is robbery.
2022-12-05 23:05:20 -08:00
nhmall
215808abd1 clear up a few gcc warnings 2022-12-05 23:19:38 -05:00
nhmall
afef4bc781 issue with mingw resolved; resume mingw build in CI 2022-12-05 19:03:11 -05:00
nhmall
b88ff70435 disable mingw build for now 2022-12-05 15:11:26 -05:00
nhw_cron
4ec67fb37a This is cron-daily v1-May-8-2022. 000files updated: Files 2022-12-05 14:25:52 -05:00
nhmall
693e708228 yet another follow-up after CI report 2022-12-05 14:12:36 -05:00
nhmall
6d19d8ff1c another mingw follow-up after CI report 2022-12-05 14:07:33 -05:00
nhmall
883e4cbadd another mingw Makefile follow-up 2022-12-05 14:00:22 -05:00
nhmall
64f060bfa9 mingw Makefile updates 2022-12-05 13:54:09 -05:00
nhmall
d4968e752e fix pair of prototype differences between date.c and mdlib.c 2022-12-05 13:39:46 -05:00
nhmall
b86109e9fa Merge branch 'windows-makefile' into NetHack-3.7 2022-12-05 13:27:25 -05:00
nhmall
485797ee8c rework windows nmake file
Keep object files separate between gui and tty builds as they
are not the same binary on windows.

The stubs.c file will no longer be necessary.
2022-12-05 13:21:19 -05:00
PatR
a7b714ec5c no_charge items sanity - shop theft
More unpaid/no_charge sanity checking.  If a shop contained any
no_charge objects and was robbed, they would be left no_charge and
trigger sanity check warnings (no_charge in "untended shop") once
the shopkeeper got past any Kops in the way and exited the shop.
Earlier testing didn't wait around long enough for that exit to
happen.

Clear no_charge as soon as the robbery is detected.
2022-12-04 08:59:22 -08:00
PatR
be9e1f31af man page and usage: -D
Mention the changed character name that happens when running in wizard
mode.
2022-12-04 00:17:50 -08:00
PatR
9e3f5502a3 farlook /[mMoO] feedback, take II
Redo the way coordinate pairs are lined up for /m /O &c.

Original
|   <8,9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
Previous
|  <8, 9>  $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse
Now
|  <8,9>   $  gold pieces
| <10,10>  *  rocks
|  <9,12>  %  newt corpse

Override right justification instead of inserting a space.  It looks
better for the situation where all y values are 1 digit.
2022-12-03 23:51:00 -08:00
PatR
9329c7881d another no_charge sanity check
Kicking a no_charge item out of a shop wasn't clearing the item's
no_charge flag so trigger sanity warnings.
2022-12-03 17:57:29 -08:00
PatR
d2b3a9670a obj->no_charge insanity
An object in a shop that was marked no_charge and got removed from
the shop by means other than the hero picking it up (test case
teleported it out while hero was inside shop) was left with the
no_charge bit set.  It's supposed to only be set for objects inside
shops so was triggering the recently added no_charge sanity checks.

Changing stolen_value() to have it pass the reset_nocharge arg to
billable() solves this but could have unanticipated results with
other stealing from shops.
2022-12-02 15:13:57 -08:00