#include "cell.h" Cell::Cell() : mark( false ) , north_open( false ) , west_open( false ) , south_open( false ) , east_open( false ) { parent = this; } bool& Cell::operator[]( Dir& dir ) { switch( dir ) { case NORTH: return north_open; case WEST: return west_open; case SOUTH: return south_open; case EAST: default: return east_open; } } 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; } }