//--------------------------------------------------------------------------- #include #pragma hdrstop #include "grAuditory.h" #include "cell2.h" #include "globals.h" #include "topology.h" //--------------------------------------------------------------------------- #pragma package(smart_init) GrAuditory::GrAuditory(pBias pb,TForm1* owner,pGrCellMaker pMaker, pTopology _topology) : BiasAuditory(pb) { Owner=owner; topology=_topology; for (int i=0; inCell2==0) { delete pMaker; return; }; for (int i=0; inCell; i++) Add(cell[i]=pMaker->newCell(this,topology->x(i),topology->y(i))); for (int i=0; inCell; i++) { int j=i; while(i!=(j=(topology->nextNeigh(i,j)))) cell[i]->addNeighbour(cell[j]); }; delete pMaker; /* for (int i=0; inCell2==0) return; for (int i=0; inCell2; i++) for (int j=0; jnCell2; j++) Add(cell[i][j]=pMaker->newCell(this,i,j)); for (int i=1; inCell2-1; i++) for (int j=1; jnCell2-1; j++) { cell[i][j]->addNeighbour(cell[i-1][j]); cell[i][j]->addNeighbour(cell[i+1][j]); cell[i][j]->addNeighbour(cell[i][j+1]); cell[i][j]->addNeighbour(cell[i][j-1]); }; for (int i=1; inCell2-1; i++) { cell[i][0]->addNeighbour(cell[i-1][0]); cell[i][0]->addNeighbour(cell[i+1][0]); cell[i][0]->addNeighbour(cell[i][1]); cell[0][i]->addNeighbour(cell[0][i-1]); cell[0][i]->addNeighbour(cell[0][i+1]); cell[0][i]->addNeighbour(cell[1][i]); cell[i][(Owner->nCell2-1)]->addNeighbour(cell[i-1][(Owner->nCell2-1)]); cell[i][(Owner->nCell2-1)]->addNeighbour(cell[i+1][(Owner->nCell2-1)]); cell[i][(Owner->nCell2-1)]->addNeighbour(cell[i][Owner->nCell2-2]); cell[(Owner->nCell2-1)][i]->addNeighbour(cell[(Owner->nCell2-1)][i-1]); cell[(Owner->nCell2-1)][i]->addNeighbour(cell[(Owner->nCell2-1)][i+1]); cell[(Owner->nCell2-1)][i]->addNeighbour(cell[1][Owner->nCell2-2]); }; cell[0][0]->addNeighbour(cell[1][0]); cell[0][0]->addNeighbour(cell[0][1]); cell[0][Owner->nCell2-1]->addNeighbour(cell[0][Owner->nCell2-2]); cell[0][Owner->nCell2-1]->addNeighbour(cell[1][Owner->nCell2-1]); cell[Owner->nCell2-1][0]->addNeighbour(cell[Owner->nCell2-2][0]); cell[Owner->nCell2-1][0]->addNeighbour(cell[Owner->nCell2-1][1]); cell[Owner->nCell2-1][Owner->nCell2-1]->addNeighbour(cell[Owner->nCell2-2][Owner->nCell2-1]); cell[Owner->nCell2-1][Owner->nCell2-1]->addNeighbour(cell[Owner->nCell2-1][Owner->nCell2-2]); delete pMaker; */ };