Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing verblibm.h

CommonAncestor (lines 1352-1368)

1352  !   The object tree and determining the possibility of moves
1353  ! ----------------------------------------------------------------------------
1354   
1355  [ CommonAncestor o1 o2 i j;
1356      ! Find the nearest object indirectly containing o1 and o2,
1357      ! or return 0 if there is no common ancestor.
1358      i = o1;
1359      while (i ~= 0) {
1360          j = o2;
1361          while (j ~= 0) {
1362              if (j == i) return i;
1363              j = parent(j);
1364          }
1365          i = parent(i);
1366      }
1367      return 0;
1368  ];


Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.