Моделювання життя за допомогою ресурсів мови С++, страница 2

                                       Cir1->f[1] = Cir2->f[1];

                                       Cir2->f[1] = tmp;

                                       if (r < R)

                                       {

                                                           Cir1->k = R-r;

                                                           Cir2->k = R-r;

                                                           Cir1->b = R-r;

                                                           Cir2->b = R-r;

                                       }

                                       if ((Cir1->color == Cir2->color) &&

                                       (Cir1->preg == 0) && (Cir2->preg == 0) &&

                                       (Cir1->R >=8) && (Cir1->R < 25))

                                       {

                                                           Cir1->PregnantSM ();

                                       }

                                       if (Cir1->color==15)

                                       {

                                                           Cir2->inf=1;

                                       }

                                       if (Cir2->color==15)

                                       {

                                                           Cir1->inf=1;

                                       }

                    }

}

void TouchCirScr (CPoint *Cir)

{

                    if (Cir->X-Cir->R <= 0) Cir->f[0]=0;

                    if (Cir->X+Cir->R >= 640) Cir->f[0]=1;

                    if (Cir->Y-Cir->R <= 0) Cir->f[1]=0;

                    if (Cir->Y+Cir->R >= 480) Cir->f[1]=1;

}

CList::CList(void)

{

                    PHead=NULL;

};

void CList::AddNode(CPoint *PNObj)

{

                    PTemp=new CNode;

                    PTemp->PNext=PHead;

                    PTemp->PObj=PNObj;

                    PHead=PTemp;

};

void CList::ShowAll(void)

{

                    PTemp=PHead;

                    while(PTemp!=NULL)

                    {

                                       PTemp->PObj->Show();

                                       PTemp=PTemp->PNext;

                    }

};

void CList::MoveAll(void)

{

                    PTemp=PHead;

                    CNode *PCur;

                    while(PTemp!=NULL)

                    {

                                       PCur=PTemp->PNext;

                                       TouchCirScr (PTemp->PObj);

                                       while (PCur!=NULL)

                                       {

                                                           TouchCirs (PTemp->PObj, PCur->PObj);

                                                           PCur=PCur->PNext;

                                       }

                                       PTemp->PObj->Move (1, 1);

                                       if ((PTemp->PObj->death == 1)||(PTemp->PObj->inf == 1))