]> granicus.if.org Git - nethack/log
nethack
2 years agofix #K3633 - vault guard parked at <0,0> brought \
PatR [Wed, 13 Jul 2022 22:19:51 +0000 (15:19 -0700)]
fix #K3633 - vault guard parked at <0,0> brought \

back into play with bad data

I don't have a test case to verify the fix, and I'm not absolutely
certain that the cause has been correctly diagnosed, but I think the
problem was caused by a guard being sent into limbo because the map
was too full to place it, then while it was on the migrating monsters
list waiting for a chance to come back the fuzzer executed #wizmakemap.
If the hero left the level and subsequently returned, the guard would
arrive back but monst->mextra->egd contained data for the previous
incarnation of the level that's invalid for wizmakemap's replacement.

Treat any shopkeeper, temple priest, or vault guard who is not on his
'home' level like the Wizard has been treated since 3.6.0.  When
leaving the level they're on, put them on the migrating monsters list
scheduled to return to present position instead of stashing them in
the level's data file.  That way they can be accessed from any dungeon
level, so wizmakemap can pull ones for the level it's replacing off
the migrating monsters list when removing the old level's monsters,
handling both migration-pending and already-arrived-on-another-level.

Bonus fix:  put monsters who are on the migrating_mons list solely in
order to be accessible from other levels back first when returning to
the level they're on so that pets and the hero can't hijack their spot
when those arrive.  The Wizard has been vulnerable to that.

Not fixed:  #wizfliplevel command needs to flip parts of shk->mextra->
eshk and priest->mextra->epri for shk or priest on migrating_mons.
Vault guards don't contain anything flippable when migrating, but do
have coordinates that need fixing up while they're maintaining a
temporary corridor to/from the vault.

2 years agoGrid bugs don't have hands
Pasi Kallinen [Wed, 13 Jul 2022 08:21:16 +0000 (11:21 +0300)]
Grid bugs don't have hands

Fixes #799

2 years agoValkyries start with a spear instead of a long sword
Pasi Kallinen [Tue, 12 Jul 2022 19:56:30 +0000 (22:56 +0300)]
Valkyries start with a spear instead of a long sword

Long swords are overused, and Knights already start with a long sword.
No other roles start with a spear. Lawful Valks shouldn't have an easy
way to get Excalibur.

There's also historical precedence for valkyries with spears, see eg.
Wagner's Ring Cycle.

This makes Valks early game damage slightly lower, although dwarven spear
does the same damage to small monsters as long sword, and there should be
plenty of chances to get one from the mines. Spears can also be thrown.

This change has been done in several variants, eg. xNetHack and Fourk.

2 years agoApplying a cursed lamp can make your hands slippery
Pasi Kallinen [Tue, 12 Jul 2022 19:12:52 +0000 (22:12 +0300)]
Applying a cursed lamp can make your hands slippery

2 years agoMore message variation on eating palatable corpses
Pasi Kallinen [Tue, 12 Jul 2022 18:51:41 +0000 (21:51 +0300)]
More message variation on eating palatable corpses

2 years agoAlways give a message when dipping an item into a fountain
Pasi Kallinen [Tue, 12 Jul 2022 18:10:19 +0000 (21:10 +0300)]
Always give a message when dipping an item into a fountain

2 years agoRejigger anti-magic traps
Pasi Kallinen [Tue, 12 Jul 2022 17:24:27 +0000 (20:24 +0300)]
Rejigger anti-magic traps

My changes were too drastic, so reduce the drain and damage so it
matches all the other traps. Now the anti-magic trap will always
ding your max energy a bit, in addition to the physical damage done
if wearing magic resistance.

2 years agobump EDITLEVEL
PatR [Sun, 10 Jul 2022 22:43:49 +0000 (15:43 -0700)]
bump EDITLEVEL

The most recent "simulated mouse" commit included changes to 'struct u'
that should have been accompanied by an increment in EDITLEVEL.  Do the
missing increment now.

2 years agosimulated mouse again
PatR [Sun, 10 Jul 2022 18:14:10 +0000 (11:14 -0700)]
simulated mouse again

Change u.{dx,dy,dz} from schar to int and get rid of unused u.di.

Remove just added getdir_ok2click; it was declared as int but being
assigned booleans.  Rename getloc_click to getdir_click and have
getdir() use it for both input and output.

A simulated mouse is becoming quite a nuisance for something which
will probably never be used by anyone in actual play.

2 years agorestore getdir simulated mouse click
PatR [Sun, 10 Jul 2022 13:55:16 +0000 (06:55 -0700)]
restore getdir simulated mouse click

When getdir is given '_' as a direction, it calls getpos to get a
map location rather than just a direction.  Have getdir()'s caller
explicitly enable that so using '_' for other than #therecmdmenu
doesn't produce a delta that's farther than one step away.

2 years agoPraying on an altar with pet corpse on it can revive the pet
Pasi Kallinen [Sun, 10 Jul 2022 09:56:20 +0000 (12:56 +0300)]
Praying on an altar with pet corpse on it can revive the pet

2 years agoMake sure getdir return values are in range
Pasi Kallinen [Sun, 10 Jul 2022 08:00:22 +0000 (11:00 +0300)]
Make sure getdir return values are in range

u.dx and u.dy should be [-1, +1]

2 years agoUnhide monster when object is dropped through hole
Pasi Kallinen [Sat, 9 Jul 2022 15:44:23 +0000 (18:44 +0300)]
Unhide monster when object is dropped through hole

Monster hiding under an object on a hole, the object got
knocked down the hole, the monster kept hiding.

2 years agorephrase some livelog messages
PatR [Sat, 9 Jul 2022 01:24:36 +0000 (18:24 -0700)]
rephrase some livelog messages

From entrez:  rephrase the terse livelog messages so that they form
complete sentences.

2 years agomaybe fix #K3634 - failed migrating mov arrival
PatR [Fri, 8 Jul 2022 18:07:36 +0000 (11:07 -0700)]
maybe fix #K3634 - failed migrating mov arrival

place_monster() sanity check complained that a long worm was being
put at the same location as another monster.  The long worm wasn't
on the map prior to that place attempt.  This probably fixes it but
I don't a test case so am not sure.

2 years agoFix monster hiding under candle burning away
Pasi Kallinen [Fri, 8 Jul 2022 10:39:19 +0000 (13:39 +0300)]
Fix monster hiding under candle burning away

Reveal the monster when the candle it was hiding under burned away.

2 years agoTrapped monster cannot move to swallow another
Pasi Kallinen [Fri, 8 Jul 2022 07:47:00 +0000 (10:47 +0300)]
Trapped monster cannot move to swallow another

The swallower kept their trapped-state, but could be moved to
another location. Just deal with it by not letting a trapped monster
swallow.

2 years agoUntrap monster when lregion removes the trap
Pasi Kallinen [Thu, 7 Jul 2022 09:27:28 +0000 (12:27 +0300)]
Untrap monster when lregion removes the trap

This check really should go in deltrap itself, but that would require
more effort than I have spoons for right now.

2 years agoUntrap monster in trap on melting ice
Pasi Kallinen [Wed, 6 Jul 2022 17:16:12 +0000 (20:16 +0300)]
Untrap monster in trap on melting ice

Monster trapped in a trap on melting ice, the monster stayed
trapped even as the trap was removed when the ice melted.

2 years agoconfig_error_add()'s terminating period
PatR [Wed, 6 Jul 2022 06:20:58 +0000 (23:20 -0700)]
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.

2 years agorefine PR #814 - included weapon in first hit mesg
PatR [Tue, 5 Jul 2022 20:10:45 +0000 (13:10 -0700)]
refine PR #814 - included weapon in first hit mesg

When naming the weapon in the livelog message for breaking "never
hit with wielded weapon" conduct, avoid xname() because it includes
"<item> named <something or other>".  That's partly censorship and
partly keeping the message from being longer than necessary.  Long
messages on tty cause '#chronicle' output to become ugly.

2 years agopull request #814 - log mesg for 1st weapon hit \
PatR [Tue, 5 Jul 2022 18:50:20 +0000 (11:50 -0700)]
pull request #814 - log mesg for 1st weapon hit \

now includes what the weapon was

Pull request from vultur-cadens:  show the weapon used when logging
the breaking of "never hit with a wielded weapon" conduct.

Also, if that first hit was a successful joust attack it was being
shown twice.

Closes #814

2 years agoLog the weapon that breaks weaponless conduct
vultur-cadens [Sat, 2 Jul 2022 03:59:16 +0000 (20:59 -0700)]
Log the weapon that breaks weaponless conduct

...because I think it would be interesting to see how many monks break
it with a pick-axe.

Also fix a bug related to logging the conduct:

* If the first hit was a joust that didn't kill the monster, the
  conduct would be double-logged.

I lifted the call to first_weapon_hit() out of mhurtle_to_doom() in
order to log the weapon before it broke.

2 years agoFire trap on ice can indirectly kill a monster via drowning
Pasi Kallinen [Sun, 29 May 2022 06:42:25 +0000 (09:42 +0300)]
Fire trap on ice can indirectly kill a monster via drowning

Make the trap routine claim the trap killed the monster even
though it was drowning that did it, otherwise callers cannot
rely on the trap routine return value.

2 years agoFix segfault with fire trap on ice and monster triggering it
Pasi Kallinen [Sat, 28 May 2022 14:25:29 +0000 (17:25 +0300)]
Fix segfault with fire trap on ice and monster triggering it

When a monster with innate teleporting stepped on a fire trap on ice,
the ice melted and the monster teleported away before falling
into the pool. If the monster's new location had a trap, the code
tried to access the deleted fire trap.

2 years agomore #802 - lava travel rather than running
PatR [Mon, 4 Jul 2022 19:28:12 +0000 (12:28 -0700)]
more #802 - lava travel rather than running

Too many negations for my brain to cope with.  I've tested travel
properly this time, but not re-tested running (which shouldn't be
affected by this code).

2 years agoautodescribe fix follow-up
nhmall [Mon, 4 Jul 2022 05:14:34 +0000 (01:14 -0400)]
autodescribe fix follow-up

2 years agoautodescribe fix for 'I'
nhmall [Mon, 4 Jul 2022 02:26:21 +0000 (22:26 -0400)]
autodescribe fix for 'I'

> Attempting to look at 'I' (remembered, unseen monster)
> with farlook/quicklook/getpos autodescribe mis-reports it
> as "unexplored area".

2 years agoconsistency bit
nhmall [Mon, 4 Jul 2022 01:23:13 +0000 (21:23 -0400)]
consistency bit

2 years agoa few miscellaneous comments
PatR [Mon, 4 Jul 2022 00:51:47 +0000 (17:51 -0700)]
a few miscellaneous comments

2 years agopull request #811 - getpos help during ";"
PatR [Mon, 4 Jul 2022 00:40:10 +0000 (17:40 -0700)]
pull request #811 - getpos help during ";"

Pull request from entrez:  context-sensitive help.  During the
quick farlook command (aka #glance), if the player types "?" to
ask for help don't show "prompt for 'more info'" among the actions
performed for response ".".  (":" still mentions that because it
does show 'more info', if some is available, when using ";".)

Closes #811

2 years agoDon't describe 'more info' prompt in #glance help
Michael Meyer [Thu, 30 Jun 2022 00:13:45 +0000 (20:13 -0400)]
Don't describe 'more info' prompt in #glance help

When using #glance, the player is never prompted about whether she wants
'more info' about something on the map, even if flags.help is true and
she has pressed '.' -- the 'more info' prompt is exclusive to #whatis.
getpos_help already changed its description of '.' based on whether
'help' was on or off; adjust those criteria so that the description of
the 'more info' prompt is only included for #whatis, where it is
actually relevant.

I recently looked at the help while using #glance and got confused
about why the 'more info' prompt was never appearing, so hopefully this
should help forestall that sort of thing.  #glance also prompts only
once, so there's some other information about "moving to another spot"
in the help text which is not relevant -- that could definitely be
addressed as well but I think it's less likely to be confusing, so I
didn't bother with it in this commit.

2 years agofixes entry for #810 - underwater food
PatR [Mon, 4 Jul 2022 00:09:56 +0000 (17:09 -0700)]
fixes entry for #810 - underwater food

Pull request from entrez:  non-swimming pets wouldn't target
underwater food but if a flying pet happened to move over such food
it would eat that.

Fixes #810

2 years agoFix: non-swimming pets eating underwater food
Michael Meyer [Wed, 29 Jun 2022 21:19:59 +0000 (17:19 -0400)]
Fix: non-swimming pets eating underwater food

Commit 32234b1d in 2003 mentioned in its commit message that pet dragons
shouldn't be able to eat underwater food items.  This was mostly true:
non-swimming pets wouldn't select underwater food as a goal, and
wouldn't spend an action eating something unreachable on their current
position.  But the "combined eat and move" case in dog_move didn't check
could_reach_item, so if a non-swimming pet happened to move to a spot
with underwater food for some reason, they could eat it on that turn
anyway.  This commit should close this loophole and prevent non-swimming
monsters from eating underwater food (or other unreachable food) even if
they happen to fly over its position.

2 years agopull request #809 - just-picked pseudo class and $
PatR [Sun, 3 Jul 2022 23:55:22 +0000 (16:55 -0700)]
pull request #809 - just-picked pseudo class and $

Pull request from entrez:  gold wasn't handled consistently when
performing object class filtering with the just-picked-up pseudo
class.

Closes #809

2 years agoallow_category: honor 'goldX' more consistently
Michael Meyer [Mon, 27 Jun 2022 20:17:52 +0000 (16:17 -0400)]
allow_category: honor 'goldX' more consistently

A comment in allow_category states that if gold is explicitly selected
as a category, it should be included in the results regardless of what
other BUCX filters may have also been applied.  That makes sense to me:
there's only one thing in the gold category, and it always has the same
BUCX status, so it's pointless to try to "filter" the gold category with
a BUCX filter.  Considering it a "also add gold, on top of the filtered
results" category adds utility.

However, other categories which may include gold (specifically
justpicked; unpaid is in the code too, but that can't actually happen
in-game) were treated the same way: if the category included gold, no
filter could exclude it.  As a result, if the hero had just picked up
gold, 'P'+'C', 'P'+'U', 'P'+'X', and 'P'+'B' all showed the just-picked
gold pieces -- there was no way to filter justpicked to exclude gold
the BUCX categories.  This approach made less sense to me: justpicked as
a category may include gold, but filtering by BUCX actually has utility
there, and selecting it doesn't carry a "show me gold in addition to the
other filtered items" implication.

Maintain the same special treatment of selecting the coins category, but
drop it for justpicked and unpaid.  In those cases whether gold is
listed in the justpicked result will depend on it not being filtered out
by the selected BUCX categories (and which one it belongs to, in turn,
depends on the 'goldX' option).

2 years agoPermit gold to be included in justpicked typeinv
Michael Meyer [Mon, 27 Jun 2022 14:10:17 +0000 (10:10 -0400)]
Permit gold to be included in justpicked typeinv

Just-picked-up gold was included in the list of items in the just-picked
category for most category-based menus like 'D' or #loot, but special
handling of gold for 'I'/#inventtype (to accomodate the 'goldX' option)
caused it to be excluded from consideration as a just-picked item.
Include recently picked up gold in 'P'/justpicked when doing type
inventory, consist with other category-menu-based actions.

2 years agopull request #807 - 'wizmgender'
PatR [Sun, 3 Jul 2022 23:35:30 +0000 (16:35 -0700)]
pull request #807 - 'wizmgender'

Pull request from entrez:  changes in symbol handling rendered the
'wizmgender' debugging option non-functional.  Get it working again,
and when it's enabled have doname() list the corpse or statue gender
formatting those types of items for inventory or other display.

Closes #807

2 years agowizmgender: include corpstat gender in object name
Michael Meyer [Thu, 23 Jun 2022 16:10:03 +0000 (12:10 -0400)]
wizmgender: include corpstat gender in object name

Add another use to wizmgender: when it is enabled, include the gender
specified in corpstat flags in the name of a statue, corpse, or
figurine, since it can influence various things but otherwise remains
invisible (for monsters without gendered names).  A little while ago
lichen corpses weren't stacking because, despite being a neuter monster,
the corpses they produced were being flagged as female or male; this
could be useful for debugging issues along those lines.

2 years agoGet wizmgender working again
Michael Meyer [Thu, 23 Jun 2022 15:19:28 +0000 (11:19 -0400)]
Get wizmgender working again

The wizard-mode option to highlight female monsters stopped having any
in-game effect after cb0c21e.  Formerly it caused female monsters to be
highlighted with a red background (red color + inverse); this commit
uses inverse video only without overriding their color.  Ensuring the
color override works consistently with the ENHANCED_SYMBOLS 24-bit color
doesn't seem worth it for what is a very niche debugging option, and I
think inverse video should probably suffice.

It also used to be a TTY-only option, but this enables it in curses as
well.

2 years agomore #802 - lava running
PatR [Sun, 3 Jul 2022 23:27:19 +0000 (16:27 -0700)]
more #802 - lava running

From entrez, then modified possibly beyond recognition:  don't run
or travel onto lava even with known safe lava-walking because that
isn't 100% safe.  But if already on/over lava, allow moving onto
adjacent lava in that situation.

2 years agorework TTY_PERM_INVENT; update window port interface
nhmall [Sun, 3 Jul 2022 04:34:08 +0000 (00:34 -0400)]
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.

2 years agopull request #804 - "Continue eating?" prompt \
PatR [Sat, 2 Jul 2022 22:34:53 +0000 (15:34 -0700)]
pull request #804 - "Continue eating?" prompt \

should be skipped when current bite finishes meal

Pull request from entrez.  Treat resuming an interrupted meal with one
bite left similarly to starting a meal that only takes one bite.

Closes #804

2 years agoDon't prompt to continue eating with one bite left
Michael Meyer [Fri, 17 Jun 2022 14:42:14 +0000 (10:42 -0400)]
Don't prompt to continue eating with one bite left

There was already handling in place to prevent showing the "continue
eating?" prompt for one-gulp food (like a wraith corpse), since the hero
would finish eating the food on that turn regardless of what the player
answered to the prompt.  Resuming an interrupted multi-bite meal with
only a single bite remaining had the same problem, but wasn't accounted
for in the special "one gulp" handling.  Modify the condition so it
checks for the number of bites remaining in the food, not the number of
bites total, and show the prompt only when there's more than one bite
left.

2 years agopull request #802 - water running
PatR [Sat, 2 Jul 2022 22:12:12 +0000 (15:12 -0700)]
pull request #802 - water running

Pull request from entrez:  allow rush/run to move over water if
wearing discovered water walking boots.  (Having walked over water
while wearing them but without them being discovered isn't sufficient.
Hypothetically there could some other method of acquiring water
walking ability.)  #802 supersedes #454.

Closes #802

2 years agoAllow travel on water with IDed water walking
Michael Meyer [Thu, 30 Jun 2022 18:09:16 +0000 (14:09 -0400)]
Allow travel on water with IDed water walking

If you have a known source of water walking (i.e. are wearing formally
IDed water walking boots), allow travel to path you over water and allow
running over water.  A transition from land to water will still cause
the hero to stop in modes other than the shift+dir "move until you hit
something" running mode, so that you don't careen across the entire
level unless you really want to.

Also, fix running over water when levitation or flying is equipped.
This stopped working after f88dce6970, only allowing the hero to move
one square at a time.  And prevent travel from pathing the hero into a
wall of water even if flying or levitation is equipped, since they don't
allow you to bypass that terrain.

2 years agopull request #801 - triggering landmines \
PatR [Sat, 2 Jul 2022 22:03:52 +0000 (15:03 -0700)]
pull request #801 - triggering landmines \

by monsters is based on their weight

Pull request from entrez:  instead of straight 2/3 chance for a monster
to trigger a landmine, base the chance on monster's weight.

Closes #801

2 years agoMake monsters trigger landmines based on weight
Michael Meyer [Wed, 15 Jun 2022 21:40:56 +0000 (17:40 -0400)]
Make monsters trigger landmines based on weight

The 1/3 likelihood of a monster setting off a landmine seemed a little
arbitrary to me, especially in that it applied equally to all monsters,
from giants to insects.  Change the flat 33% chance to one based on the
monster's body weight, so that lightweight monsters have little to no
chance of setting off a mine, with the likelihood increasing from there
with the monster's weight.

With a trigger weight of 400, as it is in this commit, a dingo has a 0%
chance of setting off a landmine, a gelatinous cube the same 33% chance
as before, an elf a 50% chance, a human a 72% chance, and something the
size of a dragon (ignoring the reduced likelihood for flying monsters) a
91% chance.

2 years agoboulder sanity check
PatR [Sat, 2 Jul 2022 18:54:31 +0000 (11:54 -0700)]
boulder sanity check

From entrez, pushing a boulder into the water on Plane of Water
resulted in a sanity check warning about a boulder at water location
(every turn until bubble movement eventually pushed it back out of
the water).  Make boulders in that situation always fail to plug the
water and vanish rather not attempt to plug and remain intact.

This also changes the chance to plugging water from 90% to 50% when
dealing with a wall of water somewhere other than Plane of Water.

2 years agoa couple of follow-ups
nhmall [Sat, 2 Jul 2022 13:21:58 +0000 (09:21 -0400)]
a couple of follow-ups

2 years agobe more consistent with coordinates
nhmall [Sat, 2 Jul 2022 13:10:03 +0000 (09:10 -0400)]
be more consistent with coordinates

2 years agoteleport feedback for STRAT_APPEARMSG mon
PatR [Fri, 1 Jul 2022 22:53:53 +0000 (15:53 -0700)]
teleport feedback for STRAT_APPEARMSG mon

Reported by entrez:  if a monster with the STRAT_APPEARMSG flag is
seen to teleport away from its current position, an arrival message
would always be given too.  If you couldn't see that arrival, you'd
get nonsensical "It suddenly appears!".

Minor fix:  when a monster is seen to vanish at one spot and appear
at another, if it was not close you'd get either "appears closer to
you" or "appears farther from you" even if the new spot was the same
distance as the old spot.

2 years agoregex handling
PatR [Fri, 1 Jul 2022 20:08:43 +0000 (13:08 -0700)]
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.

2 years agoupdate visual studio project files
nhmall [Fri, 1 Jul 2022 15:47:02 +0000 (11:47 -0400)]
update visual studio project files

2 years agoWindows console limits
nhmall [Fri, 1 Jul 2022 12:37:10 +0000 (08:37 -0400)]
Windows console limits

2 years agodon't alter perm_invent during fuzzer
nhmall [Fri, 1 Jul 2022 12:36:33 +0000 (08:36 -0400)]
don't alter perm_invent during fuzzer

2 years agocomment update
nhmall [Fri, 1 Jul 2022 12:36:03 +0000 (08:36 -0400)]
comment update

2 years agotypedef follow-up
nhmall [Fri, 1 Jul 2022 12:23:31 +0000 (08:23 -0400)]
typedef follow-up

2 years agochange xchar to other typedefs
nhmall [Fri, 1 Jul 2022 03:48:18 +0000 (23:48 -0400)]
change xchar to other typedefs

One of the drivers of this change was that screen coordinates require a
type that can hold values greater than 127. Parameters to the window
port routines require a large type in order to be able to have values
a fair bit larger than COLNO and ROWNO passed to them, particularly for
their use to the right of the map window.

This splits the uses of xchar into 3 different situations, and adjusts
their type and size:

                        xchar
                          |
               -----------------------
               |          |          |
            coordxy     xint16     xint8

coordxy: Actual x or y coordinates for various things (moved to 16-bits).

xint16:  Same data size as coordxy, but for non-coordinate use (16-bits).

xint8:   There are only a few use cases initially, where it was very
         plain to see that the variable could remain as 8-bits, rather
         than be bumped to 16-bits.  There are probably more such cases
         that could be changed after additional review.

Note: This first changed all xchar variables to coordxy. Some were
reviewed and got changed to xint16 or xint8 when it became apparent that
their usage was not for coordinates.

This increments EDITLEVEL in patchlevel.h

2 years agoRevert "follow-up: use only the memory that's required"
nhmall [Fri, 1 Jul 2022 02:38:14 +0000 (22:38 -0400)]
Revert "follow-up: use only the memory that's required"

This reverts commit 4a0654c70875964fbe769165e04aebe2713cbe34.

2 years agoRevert "follow-up 2: follow the conventional approach"
nhmall [Fri, 1 Jul 2022 02:37:12 +0000 (22:37 -0400)]
Revert "follow-up 2: follow the conventional approach"

This reverts commit 6920632df0fee38b7b33c6fa13a4eecc3e574981.

2 years agoRevert "follow-up 3"
nhmall [Fri, 1 Jul 2022 02:36:45 +0000 (22:36 -0400)]
Revert "follow-up 3"

This reverts commit cd57dfa5ffa3a408f07b24b24e2c758301fed143.

2 years agoRevert "follow-up 4"
nhmall [Fri, 1 Jul 2022 02:36:21 +0000 (22:36 -0400)]
Revert "follow-up 4"

This reverts commit 9e38fb661d92558b6c590b8d96bb8fdbd587a7e5.

2 years agofollow-up 4
nhmall [Thu, 30 Jun 2022 17:42:14 +0000 (13:42 -0400)]
follow-up 4

2 years agofollow-up 3
nhmall [Thu, 30 Jun 2022 17:27:46 +0000 (13:27 -0400)]
follow-up 3

2 years agofollow-up 2: follow the conventional approach
nhmall [Thu, 30 Jun 2022 17:15:58 +0000 (13:15 -0400)]
follow-up 2: follow the conventional approach

2 years agofollow-up: use only the memory that's required
nhmall [Thu, 30 Jun 2022 17:10:56 +0000 (13:10 -0400)]
follow-up: use only the memory that's required

2 years agocppregex regex_error_desc()
nhmall [Thu, 30 Jun 2022 16:58:19 +0000 (12:58 -0400)]
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.

2 years agoupdated window_procs
nhmall [Thu, 30 Jun 2022 03:21:19 +0000 (23:21 -0400)]
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.

2 years agono quotes in WINDOWPORT macro invocation
nhmall [Thu, 30 Jun 2022 02:13:28 +0000 (22:13 -0400)]
no quotes in WINDOWPORT macro invocation

2 years agopull request #797 - running past quest leader \
PatR [Thu, 30 Jun 2022 01:28:01 +0000 (18:28 -0700)]
pull request #797 - running past quest leader \

and not stopping if tossed out of the quest

Pull request from entrez:  a running or travelling hero who passes
next to the quest leader and gets tossed back through the portal for
some reason would keep on running on the far side.

Closes #797

2 years agoFix: running through quest expulsion
Michael Meyer [Fri, 10 Jun 2022 14:51:15 +0000 (10:51 -0400)]
Fix: running through quest expulsion

If a player was in the process of running past the quest leader when she
got expelled from the quest, she would continue running out of the quest
portal on the portal level.  Interrupt any running (or other multi-turn
action) when expelling the hero from the quest level.

2 years agopull request #792 - pet w/ engulf+digest \
PatR [Thu, 30 Jun 2022 01:08:50 +0000 (18:08 -0700)]
pull request #792 - pet w/ engulf+digest \

can gain intrinsics by swallowing monsters whole

Pull request #792 from entrez:  monsters can gain instrinsics now but
the case for an engulfer digesting a live monster was overlooked.

Add the same for non-pet monsters digesting other monsters, likely
under the influence of conflict but possibly counter-attacking a pet.

Closes #792

2 years agoAllow intrinsic gain from pet's digestion attack
Michael Meyer [Mon, 6 Jun 2022 20:03:51 +0000 (16:03 -0400)]
Allow intrinsic gain from pet's digestion attack

Add possible pet intrinsic gain from swallowing a monster in one gulp
(in situations where a corpse is created and eaten by the engulfer),
making it equivalent in this regard to eating the corpse off the floor.

One possible extension or modification would be to reduce the chance of
receiving an intrinsic when the corpse is consumed via digestion attack,
similar to how the corpse nutrition is 50% of its normal value.  I
didn't incorporate that into this commit since the chance of receiving
an intrinsic is tied to monster level rather than nutrition, so I wasn't
sure if it made sense.

2 years agofix 'D' vs obj->bypass
PatR [Wed, 29 Jun 2022 18:46:31 +0000 (11:46 -0700)]
fix 'D' vs obj->bypass

Reported by entrez:  dropping items with the 'D' command sets
obj->bypass which prevents an otherwise compatible item from merging
with non-bypass floor stack.

'D' sets the bypass bit to avoid trouble if a dropped item triggers
an explosion that destroys some of inventory (making straightforward
invent traversal be unreliable).  Having bypass set prevented merging
with a floor stack that had that flag bit clear.  That was very
noticeable if a subset of a stack was picked up and then 'D' used to
drop it again, resulting in two stacks instead of recombining into
the original.

Change the test for mergability to ignore bypass so items will merge
when one has it set and other doesn't.  And when successfully merging
set bypass on the combined stack if either part had that set.

3 years agopull request #806 - remove unnecessary variable
PatR [Tue, 28 Jun 2022 19:53:16 +0000 (12:53 -0700)]
pull request #806 - remove unnecessary variable

Pull request from argrath: in destroy_one_item(), 'physical_damage'
is set to False with no provision for changing that it True, so the
'if (physical_damage) xxx' is never executed.  Remove it.

Closes #806

3 years agoremove unnecessary code on destroy_one_item()
SHIRAKATA Kentaro [Sat, 26 Feb 2022 11:40:43 +0000 (20:40 +0900)]
remove unnecessary code on destroy_one_item()

`physical_damage` is initialized to FALSE, and no codes change it.

3 years agopull request #800 - displaying detected traps
PatR [Tue, 28 Jun 2022 19:41:51 +0000 (12:41 -0700)]
pull request #800 - displaying detected traps

Pull request from argrath:  move display of detected traps into
separate routine to eliminate some 'goto's.

Closes #800

3 years agosplit displaying trap map into separate function
SHIRAKATA Kentaro [Sun, 8 May 2022 11:32:27 +0000 (20:32 +0900)]
split displaying trap map into separate function

3 years agoavoid becoming stunned due to level teleporting
PatR [Tue, 28 Jun 2022 19:37:06 +0000 (12:37 -0700)]
avoid becoming stunned due to level teleporting

Reported by entrez:  the code to have a hero become stunned for 1..3
turns when going though a level teleporter trap effectively negated
teleport control (except in wizard mode which is probably why this
slipped through).  Make the effect happen after level_tele instead of
before, change it from being stunned to being confused, and only
happen if hero lacks teleport control.

The association between confusion and level teleportation already
exists and this might be just enough of a hint for someone who isn't
aware of that yet to figure it out.  (Probably just wishing thinking.)

Magic portal traversal hasn't changed; it still causes brief stun.

3 years agofix build without TTY_PERM_INVENT defined
nhmall [Mon, 27 Jun 2022 21:43:47 +0000 (17:43 -0400)]
fix build without TTY_PERM_INVENT defined

3 years agocomment still not right
nhmall [Mon, 27 Jun 2022 12:34:41 +0000 (08:34 -0400)]
comment still not right

3 years agocomment update
nhmall [Mon, 27 Jun 2022 12:21:37 +0000 (08:21 -0400)]
comment update

3 years agosome tty perminvent follow-up()
nhmall [Mon, 27 Jun 2022 12:13:37 +0000 (08:13 -0400)]
some tty perminvent follow-up()

3 years agofix #K3627 - impossible placing long worm at <0,0>
PatR [Sun, 26 Jun 2022 19:22:09 +0000 (12:22 -0700)]
fix #K3627 - impossible placing long worm at <0,0>

When migrating, a long worm is removed from the map to take off the
tail, then its head is put back to be treated like other monsters.
If that occurred when being forced to re-migrate during failure to
arrive from a prior migration, it wouldn't have valid coordinates
and the place_monster attempt produced an impossible warning.
(Other types of monsters don't get removed and put back so didn't
trigger the problem.)

The routine to format a monster when the data is suspect mistakenly
thought it was dealing with a long worm tail because the monster
didn't match level.monsters[0][0], so the warning inaccurately
reported the problem as "placing long worm tail".

3 years agoFix underflow in free_window_info
Brian Campbell [Sun, 26 Jun 2022 14:30:58 +0000 (15:30 +0100)]
Fix underflow in free_window_info
At the end this is called after `WIN_MESSAGE` is reset to `-1`, so we
need a check here.

3 years agoTTY_PERM_INVENT tweaks
nhmall [Sun, 26 Jun 2022 02:26:18 +0000 (22:26 -0400)]
TTY_PERM_INVENT tweaks

3 years agoinitializers, take 2
nhmall [Sat, 25 Jun 2022 19:29:27 +0000 (15:29 -0400)]
initializers, take 2

3 years agoinitializers
nhmall [Sat, 25 Jun 2022 19:16:57 +0000 (15:16 -0400)]
initializers

3 years agopartial vampire fix
PatR [Sat, 25 Jun 2022 18:26:05 +0000 (11:26 -0700)]
partial vampire fix

From a followup comment to a reddit post:  a vampire who has gained
levels loses them when reverting to base form.  This fixes the case
where it grows into a vampire lord; change the base form from plain
vampire to lord when that happens.

It does not fix the case where shapechanging to fog or bat or wolf
and then back to base form yields a new vampire or vampire lord
instead of the one that built itself up.  Mainly affects pet vampires
since wild oees don't tend to grow very much.

3 years agointerface groundwork for core-side color decisions
nhmall [Sat, 25 Jun 2022 17:21:51 +0000 (13:21 -0400)]
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

3 years agoremove now unneeded {} block in switch
nhmall [Sat, 25 Jun 2022 13:32:10 +0000 (09:32 -0400)]
remove now unneeded {} block in switch

3 years agorework mode settings on the windowport-side
nhmall [Sat, 25 Jun 2022 13:17:56 +0000 (09:17 -0400)]
rework mode settings on the windowport-side

3 years agorework the mode settings initialization core-side
nhmall [Sat, 25 Jun 2022 13:06:39 +0000 (09:06 -0400)]
rework the mode settings initialization core-side

3 years agostreamline the tty perm_invent bounder box set up
PatR [Sat, 25 Jun 2022 06:35:26 +0000 (23:35 -0700)]
streamline the tty perm_invent bounder box set up

For the tty perm_invent boundary box initialiation, instead of doing
one of many assignments that do glyph lookup, do one of many symbol
assignments and one glyph lookup.  No change in observable behavior.

Also, use the main dungeon's walls for box rendering instead of
selecting ones for whatever branch the hero happens to be in at the
time perm_invent gets enabled.

3 years agomove TTYINV environ var check outside of if block
nhmall [Sat, 25 Jun 2022 04:15:40 +0000 (00:15 -0400)]
move TTYINV environ var check outside of if block

3 years agoenvironment variable TTYINV ignored
nhmall [Sat, 25 Jun 2022 00:39:15 +0000 (20:39 -0400)]
environment variable TTYINV ignored

> Setting TTTINV in the environment no longer has any effect
> for me.

Variable was set immediately prior to the all-zeros
initialization. Fix the ordering of the two statements.

3 years agofix perm_invent via 'O' border issue
nhmall [Sat, 25 Jun 2022 00:10:11 +0000 (20:10 -0400)]
fix perm_invent via 'O' border issue

> Start with default symbol set and with perm_invent Off.
> Use 'O' to change perm_invent to On.  The inventory with
> boundary box lines will briefly appear, then immediately be
> redrawn without those lines.

3 years agofollow-up
nhmall [Fri, 24 Jun 2022 19:22:38 +0000 (15:22 -0400)]
follow-up

3 years agomove some parts of TTY_PERM_INVENT into core
nhmall [Fri, 24 Jun 2022 19:01:38 +0000 (15:01 -0400)]
move some parts of TTY_PERM_INVENT into core

This starts the tty perm_invent just in time later in the
startup rather than initializing it with the other
game windows.

This also splits the duties:

The core will inquire from the window port about how many
inventory slots it can fill.

The core will handle figuring out the inventory text and
inventory letters, and will do the traversing of internal
data structures like obj chains, and passing customization
options on to the window port.

The window port will look after placing each inventory slot's
text at an appropriate location on the screen.

This, in theory, makes the core-portion available for
window ports other than tty to use, though none currently do.
The decision of what goes in an inventory slot is all left up
to the core with the update_invent_slot interface.

Documentation updates will come later, not at this time.