#include "cell.h" Cell::Cell() { parent = this; } Cell *Cell::getGroup() { Cell *cur = this; if( parent == this ) { return this; } else { Cell *group = parent->getGroup(); parent = group; return group; } } bool Cell::inSameGroup( Cell& other ) { return getGroup() == other.getGroup(); } void Cell::combineGroups( Cell& other ) { Cell *myGroup = getGroup(); Cell *yourGroup = other.getGroup(); if( myGroup != yourGroup ) { myGroup->parent = yourGroup; } }