Allow client to select map as well, sometimes
This commit is contained in:
parent
b163c214fe
commit
b729c7bbcd
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -200,10 +200,11 @@ impl LobbyPanel {
|
|||||||
pub fn update_map_selection(&mut self, idx: u8) {
|
pub fn update_map_selection(&mut self, idx: u8) {
|
||||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
||||||
match peer {
|
match peer {
|
||||||
PeerKind::Client(..) => {
|
PeerKind::Client(peer, addr) => {
|
||||||
if let Some(map_selection) = &mut self.map_selection {
|
if let Some(map_selection) = &mut self.map_selection {
|
||||||
map_selection.select(idx as i32);
|
map_selection.select(idx as i32);
|
||||||
self.run_deferred(|s| s.update_players(false));
|
self.run_deferred(|s| s.update_players(false));
|
||||||
|
peer.send_reliable(addr, Package::SelectMap(idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PeerKind::Server(peer, _) => {
|
PeerKind::Server(peer, _) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user