|
|
@ -27,24 +27,22 @@ impl Game {
|
|
|
|
send_queue.push(token, "\n\nUsername: ", false, None);
|
|
|
|
send_queue.push(token, "\n\nUsername: ", false, None);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
match self.check_player_name(message) {
|
|
|
|
match self.check_player_name(message) {
|
|
|
|
PlayerCheck::Ok(name) => {
|
|
|
|
PlayerCheck::Ok(name) => match self.db.find_player_by_name(&name) {
|
|
|
|
match self.db.find_player_by_name(&name) {
|
|
|
|
Ok(Some(_)) => {
|
|
|
|
Ok(Some(_)) => {
|
|
|
|
send_queue.push(token, "\nPassword: ", false, None);
|
|
|
|
send_queue.push(token, "\nPassword: ", false, None);
|
|
|
|
client.state = State::Login(Login::Password(name));
|
|
|
|
client.state = State::Login(Login::Password(name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(None) => {
|
|
|
|
Ok(None) => {
|
|
|
|
send_queue.push(
|
|
|
|
send_queue.push(
|
|
|
|
token,
|
|
|
|
token,
|
|
|
|
format!("\nCreate {}? [y/N]: ", name),
|
|
|
|
format!("\nCreate {}? [y/N]: ", name),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
client.state = State::Login(Login::CreateUser(name));
|
|
|
|
client.state = State::Login(Login::CreateUser(name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(_) => {
|
|
|
|
Err(_) => {
|
|
|
|
send_queue.push(token, "\nError\n\nUsername: ", false, None);
|
|
|
|
send_queue.push(token, "\nError\n\nUsername: ", false, None);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
PlayerCheck::Err(err) => {
|
|
|
|
PlayerCheck::Err(err) => {
|
|
|
@ -53,7 +51,7 @@ impl Game {
|
|
|
|
send_queue.push(token, format!("{}\n", line), false, None);
|
|
|
|
send_queue.push(token, format!("{}\n", line), false, None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
send_queue.push(token, "\n\nUsername: ", false, None);
|
|
|
|
send_queue.push(token, "\n\nUsername: ", false, None);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|