From e4dbe50f39a1a1e6fb24504cf7e3391f235a9439 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 Jan 2024 19:22:18 +0000 Subject: [PATCH] Tick client when in server info menu --- voxygen/src/menu/server_info/mod.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/voxygen/src/menu/server_info/mod.rs b/voxygen/src/menu/server_info/mod.rs index 731983adfd..3aa494d27a 100644 --- a/voxygen/src/menu/server_info/mod.rs +++ b/voxygen/src/menu/server_info/mod.rs @@ -12,7 +12,10 @@ use crate::{ Direction, GlobalState, PlayState, PlayStateResult, }; use client::ServerInfo; -use common::assets::{self, AssetExt}; +use common::{ + assets::{self, AssetExt}, + comp, +}; use common_base::span; use i18n::LocalizationHandle; use iced::{ @@ -23,6 +26,7 @@ use std::{ collections::hash_map::DefaultHasher, hash::{Hash, Hasher}, }; +use tracing::error; image_ids_ice! { struct Imgs { @@ -164,6 +168,20 @@ impl PlayState for ServerInfoState { } } + if let Some(char_select) = &mut self.char_select { + if let Err(err) = char_select + .client() + .borrow_mut() + .tick(comp::ControllerInputs::default(), global_state.clock.dt()) + { + let i18n = &global_state.i18n.read(); + global_state.info_message = + Some(i18n.get_msg("common-connection_lost").into_owned()); + error!(?err, "[server_info] Failed to tick the client"); + return PlayStateResult::Pop; + } + } + // Maintain the UI. let view = self.controls.view(); let (messages, _) = self.ui.maintain(