i cant get my static character to work right. i start the first player off at 'A' which i get fine but when it goes to the next player i want the player to be 'B' and so on for the number of players casue there can be more than 2 players. but after the 'A' gets printed the second player is not 'B' it just prints some wierd character instead.
class to make characters
Code:
class Player
{
private:
char symbol;
public:
static char players;
Player() {symbol = players++;}
~Player();
char getMark() {return symbol;}
bool operator == (Player& player);
};
Player::~Player(){}
bool Player::operator == (Player& player)
{
return symbol == player.symbol;
}
// Global
char Player::players = 'A';
class to hold # of players
Code:
class Playerlist
{
private:
int size;
Player* player; // array
public:
Playerlist();
~Playerlist();
Playerlist (const Playerlist& playerlist);
int getSize() {return size;}
};
Playerlist::Playerlist()
{
player = NULL;
cout << "How many players will be playing? " << endl;
cout << "* Number of players should not exceed the cubic dimensions * " << endl;
cin >> size;
}
Playerlist::~Playerlist()
{
delete [] player;
}
Playerlist::Playerlist (const Playerlist& playerlist)
{
size = playerlist.size;
player = new Player [size];
for(int s = 0; s < size; s++)
player[s] = playerlist.player[s];
}
this is a switch statement you hin enter to mark the place you want on the board
.
Code:
.
.
.
case ENTER:
//if(array[currentDepth][currentRow][currentCol].mark(player))
// cout << "Space already taken choose again" << endl;
//else
array[currentDepth][currentRow][currentCol].mark(player);
player++;
break;
so in short ststic character starts at A and for each player in game it gets incramented ie: player2 = B player 3 = C etc. but it dont do that i get a different character when its incramented