Allow client to select map as well, sometimes

This commit is contained in:
Sofia 2026-07-22 03:25:52 +03:00
parent b163c214fe
commit b729c7bbcd
2 changed files with 9 additions and 1 deletions

View File

@ -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);
}
}
}
_ => {}
},
},

View File

@ -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, _) => {