Re-add the handling of error when the player loses connection on the character select screen.

This commit is contained in:
Shane Handley 2019-10-20 16:24:36 +09:00 committed by timokoesters
parent 69b008e0e6
commit b15c107f0b
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -5,7 +5,7 @@ use crate::{
session::SessionState, window::Event as WinEvent, Direction, GlobalState, PlayState,
PlayStateResult,
};
use client::{self, Client};
use client::{self, Client, Error as ClientError};
use common::{assets, clock::Clock, comp, msg::ClientState};
use log::error;
use scene::Scene;
@ -113,7 +113,20 @@ impl PlayState for CharSelectionState {
.borrow_mut()
.tick(comp::ControllerInputs::default(), clock.get_last_delta())
{
error!("Failed to tick the scene: {:?}", err);
match err {
ClientError::ServerTimeout => {
global_state.info_message = Some(
"Connection lost!\nDid the server restart?\nIs the client up to date?"
.to_owned(),
);
error!("[session] ServerTimeout: {:?}", err);
}
_ => {
error!("[session] Failed to tick the scene: {:?}", err);
}
}
return PlayStateResult::Pop;
}