diff --git a/rust/src/net/protocol.rs b/rust/src/net/protocol.rs index 9cc680a..1388e66 100644 --- a/rust/src/net/protocol.rs +++ b/rust/src/net/protocol.rs @@ -324,6 +324,13 @@ impl NetworkManager { } } } + Package::SelectMap(map_idx) => { + if let Some(mut game) = Game::singleton() { + if game.bind().opts.allow_any_map { + game.bind_mut().change_map_selection(map_idx, true); + } + } + } _ => {} }, }, diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index 57ee8c5..00920df 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -200,10 +200,11 @@ impl LobbyPanel { pub fn update_map_selection(&mut self, idx: u8) { if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer { match peer { - PeerKind::Client(..) => { + PeerKind::Client(peer, addr) => { if let Some(map_selection) = &mut self.map_selection { map_selection.select(idx as i32); self.run_deferred(|s| s.update_players(false)); + peer.send_reliable(addr, Package::SelectMap(idx)); } } PeerKind::Server(peer, _) => {