Persist map selection

This commit is contained in:
Sofia 2026-07-22 23:04:55 +03:00
parent 1dd5573729
commit 1818c1a453

View File

@ -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