Exemplo n.º 1
0
void UniverseSTL::addRace(){
    // init race here
    int sx = rand() % board.GetH();
	int sy = rand() % board.GetW();
	int ex= rand() % board.GetH();
    int ey=sy;
    Race* Ra = new Race(sx,sy,ex,ey);
    RList.push_back(Ra);
    for( auto&it: MList ){
        if( isA<Rabbit>(it) )
        {
            Rabbit* r = (Rabbit*)it;
            r->triggerRace(Ra);
        }
        else if( isA<Turtle>(it)){
            Turtle* t = (Turtle*)it;
            t->triggerRace(Ra);
        }
    }

}
Exemplo n.º 2
0
void UniverseList::addRace(){
    // init race here
    int sx = rand() % board.GetH();
	int sy = rand() % board.GetW();
	int ex= rand() % board.GetH();
    int ey=sy;
    Race *Ra=new Race(sx,sy,ex,ey);
    RList.push_back(Ra);
    for( auto its = MList.begin(); its != MList.end(); its = its->next)
    {
        Organism *it = its->val;
        if( isA<Rabbit>(it) )
        {
            Rabbit* r = (Rabbit*)it;
            r->triggerRace(Ra);
        }
        else if( isA<Turtle>(it)){
            Turtle* t = (Turtle*)t;
            t->triggerRace(Ra);
        }
    }

}