| 270 | } |
| 271 | |
| 272 | int findRandomUnplayedGame(void) { |
| 273 | int count = 1; |
| 274 | |
| 275 | int randGame = rand() % (int)gameList.size(); |
| 276 | |
| 277 | while (gameList[randGame].hasBeenPlayed || count < (int)gameList.size()) { |
| 278 | count++; |
| 279 | randGame = rand() % (int)gameList.size(); |
| 280 | } |
| 281 | |
| 282 | if (count >= (int)gameList.size()) { |
| 283 | return -1; |
| 284 | } |
| 285 | |
| 286 | return randGame; |
| 287 | } |
| 288 | |
| 289 | void sendMapChangeMessage(bool end) { |
| 290 | std::string message = "Map change!\n"; |