forked from Euxiniar/Loup-Garou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playersSelection.h
35 lines (32 loc) · 1.01 KB
/
playersSelection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include "Player.h"
void _SelectPlayer(std::map<uint32_t, Player> &players)
{
bool playersWantToPlay{ true };
bool lessThanEight{ true };
while (playersWantToPlay && lessThanEight)
{
static uint32_t selectedPlayer{ 0 };
std::string playerName{ 0 };
std::cout << "Entrez votre pseudo :" << std::endl;
std::getline(std::cin, playerName);
std::string quitNameTest = playerName;
std::transform(quitNameTest.begin(), quitNameTest.end(), quitNameTest.begin(), ::tolower);
if (quitNameTest.size() == 1 && quitNameTest.at(0) == 'q')
if (players.size() < 8)
std::cout << "Ce jeu necessite au moins 8 joueurs !\n" << std::endl;
else
{
playersWantToPlay = !playersWantToPlay;
lessThanEight = !lessThanEight;
}
else
{
Player player(playerName);
players.emplace(selectedPlayer, player);
std::cout << "Vous avez bien ete enregistre " << players.at(selectedPlayer).getName() <<
" !\nPour arreter les enregistrements tapez 'Q'\n" << std::endl;
selectedPlayer++;
}
}
}