|
@@ -138,6 +138,16 @@ struct Turn Game::receive(std::string userInput)
|
|
|
Turn turnInProgress;
|
|
|
std::string playerSecret, original = userInput;
|
|
|
int playerNumber = -1, pos = 0;
|
|
|
+ // check for user request to add themselves to game
|
|
|
+ // userInput == add+stringOfAnyLength
|
|
|
+ if("add" == userInput.substr(0,3))
|
|
|
+ {
|
|
|
+ // add player to game
|
|
|
+ addPlayer(userInput.substr(3));
|
|
|
+ ScoreSheet lastPlayer = players.back();
|
|
|
+ // send player secret - for now it is only printed below
|
|
|
+ fprintf(stdout, "Player %s has a secret of: %d",lastPlayer.savedName, lastPlayer.secretNumber);
|
|
|
+ }
|
|
|
// look for the position of a comma in userInput
|
|
|
for(int i = 0;i < userInput.size();i++)
|
|
|
{
|