Correction pour l'entrée de données
This commit is contained in:
parent
3da8be6d52
commit
3249d68e60
@ -280,7 +280,6 @@ void Engine::Init() {
|
||||
}
|
||||
|
||||
uint64_t seed = SEED;
|
||||
std::string playname = "", srvname = "";
|
||||
char ch;
|
||||
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
@ -320,13 +319,27 @@ void Engine::Init() {
|
||||
std::cout << std::endl;
|
||||
|
||||
if (ch == 'o' || ch == 'O') {
|
||||
std::cout << "Veuillez entrer un nom de joueur: ";
|
||||
std::cin >> playname;
|
||||
std::cout << std::endl;
|
||||
char* input = new char[32];
|
||||
std::string playname, srvname;
|
||||
|
||||
std::cout << "Veuillez entrer une adresse de serveur: ";
|
||||
std::cin >> srvname;
|
||||
while (playname.size() < 1) {
|
||||
std::cout << "Veuillez entrer un nom de joueur: ";
|
||||
std::cin.ignore();
|
||||
std::cin.getline(input, 32);
|
||||
std::cout << std::endl;
|
||||
playname = input;
|
||||
if (playname.size() < 1 || playname.size() > 32)
|
||||
std::puts("Nom invalide.");
|
||||
}
|
||||
while (srvname.size() < 1) {
|
||||
std::cout << "Veuillez entrer une adresse de serveur: ";
|
||||
std::cin.getline(input, 32);
|
||||
std::cout << std::endl;
|
||||
srvname = input;
|
||||
if (srvname.size() < 1 || srvname.size() > 32)
|
||||
std::puts("Adresse serveur invalide.");
|
||||
}
|
||||
delete[] input;
|
||||
|
||||
if (!m_conn.Init()) {
|
||||
if (!m_conn.Connect(srvname.c_str(), playname)) {
|
||||
|
Loading…
Reference in New Issue
Block a user