//--------------------------------------------------------------------------- #include #pragma hdrstop #include "cell3.h" #include "globals.h" //--------------------------------------------------------------------------- #pragma package(smart_init) Cell3::Cell3(pAuditory pa,int xx,int yy, float IA, float CTON, float CTOG, float APTOSTD, float CNTSTDNTSTND): GrCell(pa,xx,yy) { applaus=IA; confToNeigh=CTON>1?1:CTON; confToGlobal=(1-confToNeigh)forEach(&TCell::addApplaus,&nGood); Count nStand = { 0 }; neighbourList->forEach(&TCell::addStanding,&nStand); if (neighbourList->getCount()!=0) { nowApplaus=applaus*(1-confToNeigh-confToGlobal)+confToGlobal*(auditory->getGlobalGood()) + confToNeigh*(nGood.a)/(float)(neighbourList->getCount()); nowApplaus= (nowStanding=((nowApplaus>=applausToStand) || (((float)nStand.a)/(float)(neighbourList->getCount()) >= countStandNeighToStand))) ? max(nowApplaus,applausToStand):nowApplaus; } else { nowApplaus=applaus*(1-confToGlobal)+confToGlobal*(auditory->getGlobalGood()); nowStanding=(nowApplaus>=applausToStand); }; }; void Cell3::initialize() { standing=(applaus>=applausToStand); };