Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void printBoard(bool bDrop, int player)
- {
- //horizontal index
- cout << " ";
- for(int xCount=0; xCount<xSize; xCount++)
- {
- cout << xCount << " ";
- if(xCount<10)
- {
- cout << " ";
- }
- }
- cout << endl;
- for(int yCount=0; yCount<ySize; yCount++)
- {
- //vertical index
- cout << yCount << " ";
- if(yCount<10)
- {
- cout << " ";
- }
- //actual board
- for(int xCount=0; xCount<xSize; xCount++)
- {
- switch(bDrop)
- {
- case true:
- //specific base drop coloring
- if(plCount==2)
- {
- if(player==1)
- {
- if(xCount<xSize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- else if(player==2)
- {
- if(xCount>=xSize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- }
- else if(plCount==4)
- {
- if(player==1)
- {
- if(xCount<xSize/2 && yCount<ySize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- else if(player==2)
- {
- if(xCount>=xSize/2 && yCount<ySize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- else if(player==3)
- {
- if(xCount<xSize/2 && yCount>=ySize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- else if(player==4)
- {
- if(xCount>=xSize/2 && yCount>=ySize/2)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x47);
- }
- }
- }
- case false:
- double percHealth=(double)(myTiles[xCount][yCount].myBuilding.health)/(double)(myTiles[xCount][yCount].myBuilding.maxHealth);
- //colors the current tile
- for(int playerCount=1; playerCount<=plCount; playerCount++)
- {
- if(myTiles[xCount][yCount].player==playerCount && myTiles[xCount][yCount].myType==tile::abuilding)
- {
- pCol=playerCol.begin()+playerCount-1;
- }
- }
- if(percHealth>0.66)
- {
- hCol=healthCol.begin();
- }
- else if(percHealth>0.33)
- {
- hCol=healthCol.begin()+1;
- }
- else if(percHealth>0)
- {
- hCol=healthCol.begin()+2;
- }
- if(myTiles[xCount][yCount].myType==tile::abuilding)
- {
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), *hCol | *pCol);
- }
- break;
- }
- //prints the tiles
- cout << myTiles[xCount][yCount].symbol;
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x07);
- cout << " ";
- }
- cout << endl;
- }
- //statistics below the board
- for(int playerCount=1; playerCount<=plCount; playerCount++)
- {
- pCol=playerCol.begin()+playerCount-1;
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), *pCol);
- cout << "P" << playerCount << endl;
- //SUBJECT TO CHANGE DUE TO PLAYER CLASS
- for(int yCount=0; yCount<ySize; yCount++)
- {
- for(int xCount=0; xCount<xSize; xCount++)
- {
- if(myTiles[xCount][yCount].player==playerCount && myTiles[xCount][yCount].myType==tile::abuilding)
- {
- if(myTiles[xCount][yCount].myBuilding.myBuildType==0)
- {
- cout << "Base: ";
- }
- cout << myTiles[xCount][yCount].myBuilding.health << "/" << myTiles[xCount][yCount].myBuilding.maxHealth << endl;
- }
- }
- }
- //SUBJECT TO CHANGE DUE TO PLAYER CLASS
- }
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x07);
- }
Advertisement
Add Comment
Please, Sign In to add comment