use get_adjacent_loc() rather than getdir() directly for some things where
you want to ensure valid adjacent coordinates are returned
<email deleted> wrote:
>>> [...]
>>> I've noticed that the loot adjacent spot code doesn't have any
>>> isok(x,y) test, so will risk crashing if used at the edge of
>>> the screen (whether deliberately, or accidentally due to being
>>> confused or stunned when picking the direction).
>> Would this not be a problem elsewhere, such as use_leash() too?
> Yes, that looks like the same risk. getdir() doesn't validate
> that the <u.ux+u.dx, u.uy,u.dy> is safe and neither does m_at(),
> so their callers need to.
>
> I did manage to provoke a crash with #loot on the plane of earth,
> although an accidental case would be a lot less likely to happen.
From a bug report. I haven't looked closely, but I think this bug is just
in the development code. If you dig in a shop with a wand while carrying
unpaid stuff, the shopkeeper would grab your pack, including the wand but
w/o clearing current_wand. It seems the right thing is to just not grab
the current_wand, since it's not in your pack while you're zapping it.
In 3.4.0, you lost the wand too.
Reported to the list. Player breaks a wand of digging causing the
shopkeeper to fall. This didn't clear unpaid items. For now, this can
only occur due to player action, so added a call to make_angry_shk to
handle this situation.
If you level teleported while on a sleeping steed, a panic and possibly a
crash would occur. I believe the same would occur by digging a hole. This
was due to keepdogs avoiding keeping sleeping pets. In these cases, it
seems there's no reason for the sleeping steed to _not_ accompany you.
Since other ways of changing level (eg stairs) don't allow this, just added
a check to keepdogs to allow the steed to go with you.
From the newsgroup: explosions handle their own shield effect
display for resisting monsters and it was ignoring user's negation
of the sparkle option to suppress shield effect.
Forwarded from the newsgroup: when a monster gets hit by wand or
spell of polymorph, any armor that fell off was protected from being
hit by that same zap, but a dropped weapon wasn't. Nor was the whole
dropped inventory in the case where the monster is killed by system
shock rather than transformed. Protect its entire inventory.
Being Stunned now disallows teleport control. Confusion may affect ability
to control level teleports, but only after asking for the destination.
Made confused level teleport failures based on luck too.
However, they could ride. Marilith is similar, but since it's MZ_LARGE,
that check disallowed riding. Added a check for slithy(), like
canwearobj() already has.
From the newsgroup: temples attended by high priests on the Astral
Plane (also in Moloch's Sanctum, although that one doesn't really matter)
give a different entry greeting than usual in order to conceal the altar's
alignment, but they were including the patron deity in the priest name
given as presenter of the message ("The high priest of Offler intones:").
From the newsgroup: traps created on the location of dug out vault
walls would be left in place when/if the vault guard repaired the walls.
Since known traps get precedence over walls when drawing the map, this
produced a display oddity in addition to the topological one.
It also appears that monsters in affected spots wouldn't be handled
correctly if they happened to be in a direct horizontal or vertical line
with the guard. I don't know whether that matches any of the assorted
unresolved old vault bugs.
This eliminates a chunk of redundant code by merging two loops.
Pulled out the code that handles reading spellbooks while confused into a
new function that can be called from learn() to handle the timed onset of
confusion starting while you're reading.
Added code to flooreffects() to implement this suggestion from <Someone>.
It kicks in while blind, only affects objects of some bulk, and also only
things dropped at your location. The map_background currently doesn't
do anything since the dropped object is remembered on top, but this will
avoid a bug if we ever add invisible objects.
When Angels were introduced, they were always lawful. Somewhere along the
line, non-lawful angels were added, but is_lminion and uses of it was never
updated to address this change. Among other things, this resulted in
non-lawful angels delivering messages via #chat that are only appropriate
for lawful angels. That is addressed simply by changing the definition of
is_lminion, which must take a struct monst, not a permonst, to return valid
results. Also, non-lawful angels should summon appropriate monsters, not
lawful minions.
When the player is poly'd to a giant, it was a bit odd that boulders
weren't listed in the throw menu, especially since the usual check for them
is throws_rocks. Since statues are not appropriate, I added this thru yet
another ugly check in getobj.
Attacking with a polearm while mounted behaves differently than
while on foot, so make mounting and dismounting when wielding one adjust
weapon status accordingly. Don't give a bashing message on first attack
if you mount with a polearm already wielded; do give one on your next
hand-to-hand attack if you just dismounted with one wielded.
Override confusion and hallucination when revealing the map with
<ctrl/F> in wizard mode. This also renames the `#poly' extended command
to `#polyself' and adds several one-line comments.
You won't be hallucinating at the end of a prayer which reveals
the Castle passtune even if you were hallucinating before hand, so
there's no point in adding joke messages in that case. Also, you
can't pray while unconscious, so ignore the soundok flag when dealing
with that tune; otherwise the player could toggle that option off in
order to bypass the tune result in favor of the golden glow effect.
More region fixes. The region restore code wasn't updating monster
ID numbers for bones data, so monsters already inside stinking clouds
might or might not be affected by them depending on arbitrary mon->mid
assignments across the old and new games.
This also flags stinking clouds in a way that lets the game keep
track of whether they were created by the player, and clears that state
for bones data so that the current player doesn't get credit or blame
for clouds left by the former one. File compatibility with 3.4.0 is
retained; if/when that eventually changes, this code can be simplified.
Testing with current development code has been limited but seems
to be working correctly; testing with actual 3.4.0 files has not been
attempted.
Incorporate a fix from <Someone> that resets the timestamp on
stinking clouds left in bones files. This does allow the cloud's ttl to
restart. Extended it to reset the player_inside flag.
Then noticed that the only placed that called in_out_region was domove().
Added calls when changing levels (which causes player_inside to be set
correctly if the cloud covers the location where the player starts on the
bones level), teleporting, and inside hurtle_step. There are still other
places that fail to call in_out_region, which others may choose to tackle.
I split out the remaining stinking cloud bug reported in the same e-mail
into a separate betabug. That one probably cannot be addressed without
changing the level file format to track the creator.
When reading a cursed or too-hard book that's covered in contact poison
(presumably in the too-hard case, reading it made the poison), and you die,
the book would not be in the bones. remove in_use mark while assessing
damage.
On the other hand, not From a bug report, the message in the "6" case says
the book explodes, but had a 1/3 chance of not disappearing in the normal
case, and 100% chance of remaining if cursed while reading - when the
player survives. Return a flag to allow the book to be destroyed in this
case. No work needed for the death case; in_use is set.
Given no objections to Pat's suggestion, putting back in the change to make
the newest debug commands consistent with the others, removing the space
from the former and the underscore from the latter.
<Someone> reported that after pushing a boulder into a pool location which
contained a fire trap on the bottom, that the trap wasn't destroyed. Added
missing delfloortrap call.
Handle sleeping consistently; of the nine places fall_asleep
is being called, only one of the them actually affected sounds.
The two cases where sleep is used to penalize overexertion aren't
affected.
<Someone> reported the messages "It seduces you and you take off your
robe. She stole a burnt +0 robe." I noticed the 2 cases here only dealt
with blindness, not seeing the nymph in general. Also, one case forced
"She", the other "It". Now they both say "She", which is consistent with
the preposition in the 2nd message. We'll continue to the assume the
gender of the seducer is obvious, even when unseen.
E-mail report from <Someone>. Don't display the "intones:" prefix when
!soundok since the message suffix won't be displayed in this case due to
a check within verbalize().
Michael pointed out that bones will never occur while swallowed because
makemon of the ghost will always fail. I suggested that the outcome made
sense, since your body may be digested, torn apart, whatever. But, there
was no explicit check for this to make it obvious this was occuring.
<Someone> reported that a Titan summoning nasty monsters via a spell
resulted in various monsters being placed on locations containing boulders.
nasty() was using the summoning monster's type to decide where to place the
summoned monsters. Note that this could theoretically also cause
inappropriate monsters to be placed in water, lava, walls, et al.
Rearranged the code to pick the monster type first.
Fix the reported bug of an unskilled rider who is unable to pick
items off the floor while mounted still being able to dip into water.
There might be other actions which need similar checking; this one only
handles the dip into pool/moat case.
Instead of adding a new artifact.h to pray.c, remove the existing
ones from attrib.c, invent.c, and mkobj.c. This also updates the Unix
and VMS editions of Makefile.src; having stale dependencies in those
for other ports could cause unnecessary recompilation but can't break
anything in this case.
This was caused by taking a copy of the name
prior to a later delobj for use in the message.
The name would always be plural if there was
more than one, so that pluralized name would
be used even if only one of the stack was
destroyed. Sometimes the name saved
was "scrolls labeled XXXX."
This patch simply saves a pluralized name
and a single version and uses the
appropriate one in the message, rather
than introducing splitobj() complications.
A relatively recent change to prevent #ride letting you move in
a way you could walk (squeeze through a tight a gap or enter doorway
diagonally) resulted in crashing due to access violation or segfault
if you tried to mount toward a spot that didn't contain any monster.
Noticed while testing saddle cursing; tried to mount while stunned....
Also, if the character had a saddle "worn" in weapon, alternate
weapon, or quiver slot, it didn't get unworn when applying the saddle
to a mount. The next time the player tried to equip something in the
same slot there'd be a warning message; I don't know whether any more
serious symptoms could occur.