From c09037a48815b2134aeb35b6824b904650202040 Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 22 Jul 2026 23:04:55 +0300 Subject: [PATCH] Persist map selection --- rust/src/ui/lobby.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index f498355..ceee8a5 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -86,20 +86,23 @@ impl IPanel for LobbyPanel { }); }); - if let Some(map_selection) = &mut self.map_selection { - for map in game.bind().maps.iter_shared() { - map_selection.add_item(&map.bind().name); - } - map_selection.select(0); - } let is_host = if let Some(peer) = &NetworkManager::singleton().bind().peer { peer.is_host() } else { false }; + if let Some(map_selection) = &mut self.map_selection { + let prev_selection = game.bind().selected_map_idx as i32; + for map in game.bind().maps.iter_shared() { + map_selection.add_item(&map.bind().name); + } + map_selection.select(prev_selection); + if is_host { + self.update_map_selection(prev_selection as u8); + } + } self.on_game_opts_update(&game.bind().opts, is_host); } - self.update_map_selection(0); if let Some(name_field) = &self.name_field { name_field