Пример #1
0
void playHole(int holeName, Hole currentHole, Player jimmy, int *score )
{
    //array of things to pass from graphics to disc class
    double* stuff;   
    int scoreHole = 0 ;
    Disc disc;
    int past = 0;
    int diff;
    
    std::string currentPic;
    
     while( !disc.checkHole(currentHole.getX(), currentHole.getY()) && !past)
    {
    	currentPic = disc.pickScreen(holeName);
    	
    	//cout << currentPic << endl;
    	
    	//play the current hole
        stuff = play(currentPic, jimmy.getSong(), currentHole.getY() - disc.getY(), currentHole.getX() - disc.getX(), *score, scoreHole);
        //throw the frisbee
        disc.letFly(stuff[0],stuff[1],stuff[2],jimmy.getPower(),jimmy.getAccuracy(), currentHole);
        //track score
        (*score)++;
        scoreHole++;
        
        //see if disc has passed hole
         if(disc.getX() > currentHole.getX()) {
        	past = 1;
        	//cout << "You passed the hole. Auto score set to 8." << endl;
        	diff = 8 - scoreHole;
        	scoreHole = 8;
        	(*score) += diff;
        }
    } 
    	// determine which end screen to show
   	if( past )
		play(currentPic,jimmy.getSong(), -6, -6, *score, scoreHole);  
        else
		play(currentPic,jimmy.getSong(), 0,0, *score, scoreHole);
	
	if( holeName == 5)
		play("../../pictures/Pat_being_a_goon.png",jimmy.getSong(), -7,-7, *score, 0);
}