protected int GetObjActToObjActDist(int a, int b)
{
Actor acta = null;
Actor actb = null;
if (IsActor(a))
acta = Actors[ObjToActor(a)];
if (IsActor(b))
actb = Actors[ObjToActor(b)];
if ((acta != null) && (actb != null) && (acta.Room == actb.Room) && (acta.Room != 0) && !acta.IsInCurrentRoom)
return 0;
Point pA;
if (!GetObjectOrActorXY(a, out pA))
return 0xFF;
Point pB;
if (!GetObjectOrActorXY(b, out pB))
return 0xFF;
// Perform adjustXYToBeInBox() *only* if the first item is an
// actor and the second is an object. This used to not check
// whether the second item is a non-actor, which caused bug
// #853874).
if (acta != null && actb == null)
{
var r = acta.AdjustXYToBeInBox(pB);
pB = r.Position;
}
// Now compute the distance between the two points
return ScummMath.GetDistance(pA, pB);
}