Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing verblibm.h

CommonAncestor (lines 918-936)

0918  !   The object tree and determining the possibility of moves
0919  ! ----------------------------------------------------------------------------
0920   
0921  [ CommonAncestor o1 o2 i j;
0922    !  Find the nearest object indirectly containing o1 and o2,
0923    !  or return 0 if there is no common ancestor.
0924   
0925    i = o1;
0926    while (i ~= 0)
0927    {
0928        j = o2;
0929        while (j ~= 0)
0930        {   if (j == i) return i;
0931            j = parent(j);
0932        }
0933        i = parent(i);
0934    }
0935    return 0;
0936  ];


Last updated 27 February 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.