get_adjacent_loc()

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.
This commit is contained in:
nethack.allison
2002-11-17 18:43:45 +00:00
parent 330bdb7d1a
commit abd3df2871
5 changed files with 53 additions and 25 deletions

View File

@@ -306,6 +306,8 @@ all objects carried by a monster who's hit by a polymorph zap are protected
sparkle option for display effects was ignored on explosions
level teleport while on a sleeping steed caused panic and possible crash
breaking wand of digging causing a shopkeeper to fall left unpaid items unpaid
use get_adjacent_loc() rather than getdir() directly for some things where
you want to ensure valid adjacent coordinates are returned
Platform- and/or Interface-Specific Fixes