waiting for players
This commit is contained in:
parent
8a69fdc81f
commit
856b55c8a6
|
@ -144,6 +144,8 @@ std::string Bot::gameToMessage(const Game& g, std::vector<TelegramAPI::MessageEn
|
|||
} else {
|
||||
out << "Winner: " << g.getWinner() << std::endl;
|
||||
}
|
||||
} else if(!g.ready()) {
|
||||
out << "Waiting for players";
|
||||
} else {
|
||||
out << "nextturn: " << (g.getNextTurn() ? "X" : "O") << std::endl;
|
||||
}
|
||||
|
@ -204,6 +206,11 @@ Game* Bot::messageToGame(const TelegramAPI::Message& msg) const {
|
|||
g->addPlayer(info);
|
||||
}
|
||||
|
||||
// game not ready, just stop
|
||||
if(!g->getPlayerB()) {
|
||||
return g;
|
||||
}
|
||||
|
||||
// read the next turn value
|
||||
char nextturn = msg.text.at(msg.text.size()-1);
|
||||
g->setNextTurn(nextturn == 'X');
|
||||
|
|
Loading…
Reference in New Issue