//--------------------------------------------------------------------------- #include #include #include #pragma hdrstop #include "auditory.h" #include "globals.h" //--------------------------------------------------------------------------- #pragma package(smart_init) TAuditory::TAuditory() { GlobalGood=0; cellList= new TCellList(); nOfCells=0; StandTime=0; RoundCount=0; ApplausMean=0; }; TAuditory::~TAuditory() { if(cellList!=NULL) { cellList->destroyContent(); cellList->destroyList(); delete cellList; cellList=NULL; }; }; void TAuditory::Add(pCell pCellA) { if(cellList==NULL) { cellList = new TCellList(); nOfCells=0; }; cellList->Add(pCellA); nOfCells++; }; void TAuditory::destroyCellList() { if (cellList==NULL) return; cellList->destroyContent(); cellList->destroyList(); delete cellList; cellList=NULL; }; float TAuditory::getGlobalGood() { return GlobalGood; }; float TAuditory::setGlobalGood(float g) { return (GlobalGood=g); }; void* TAuditory::forEach(cellMem1par f, void* p) { if (cellList==NULL) return p; return cellList->forEach(f,p); }; float TAuditory::doSumApplaus() { Sum a; a.a=0; forEach(&TCell::addApplaus,&a); return a.a; }; int TAuditory::nOfStanding() { Count a; a.a=0; forEach(&TCell::addStanding,&a); return a.a; }; void TAuditory::round() { forEach(&TCell::recalculate1par,NULL); forEach(&TCell::set1par,NULL); StandTime+=nOfStanding(); RoundCount++; }; void TAuditory::show() { forEach(&TCell::show1par,NULL); }; int TAuditory::getStandTime() { return StandTime; }; float TAuditory::getApplausMean() { return ApplausMean; }; void TAuditory::countApplausMean() { ApplausMean=doSumApplaus()/nOfCells; };