laying the groundwork

This commit is contained in:
telastrus
2019-08-07 15:42:44 -04:00
parent 2eac162ee4
commit 157c4816b3
5 changed files with 50 additions and 2 deletions

View File

@ -64,6 +64,7 @@ impl PlayState for MainMenuState {
self.main_menu_ui.login_error(
match err {
InitError::BadAddress(_) | InitError::NoAddress => "Server not found",
InitError::InvalidAuth => "Invalid username or password",
InitError::ServerIsFull => "Server is Full!",
InitError::ConnectionFailed(_) => "Connection failed",
InitError::ClientCrashed => "Client crashed",
@ -82,10 +83,12 @@ impl PlayState for MainMenuState {
match event {
MainMenuEvent::LoginAttempt {
username,
password,
server_address,
} => {
let mut net_settings = &mut global_state.settings.networking;
net_settings.username = username.clone();
net_settings.password = password.clone();
if !net_settings.servers.contains(&server_address) {
net_settings.servers.push(server_address.clone());
}
@ -107,7 +110,7 @@ impl PlayState for MainMenuState {
)));
} else {
self.main_menu_ui
.login_error("Invalid username".to_string());
.login_error("Invalid username or password".to_string());
}
}
MainMenuEvent::StartSingleplayer => {