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 site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.