! The object tree and determining the possibility of moves ! ---------------------------------------------------------------------------- [ CommonAncestor o1 o2 i j; ! Find the nearest object indirectly containing o1 and o2, ! or return 0 if there is no common ancestor. i = o1; while (i ~= 0) { j = o2; while (j ~= 0) { if (j == i) return i; j = parent(j); } i = parent(i); } return 0; ];