diff --git a/rust/src/cli_parser.rs b/rust/src/cli_parser.rs index 02124bf..d261588 100644 --- a/rust/src/cli_parser.rs +++ b/rust/src/cli_parser.rs @@ -111,7 +111,7 @@ impl CliParser { }); if let Some((map_idx, _)) = map { game.bind_mut().forced_map_selection = true; - game.bind_mut().change_map_selection(map_idx as u8); + game.bind_mut().change_map_selection(map_idx as u8, true); } } } diff --git a/rust/src/game/mod.rs b/rust/src/game/mod.rs index 44ae2fd..9701ba9 100644 --- a/rust/src/game/mod.rs +++ b/rust/src/game/mod.rs @@ -482,8 +482,8 @@ impl Game { }); } - pub fn change_map_selection(&mut self, map_idx: u8) { - if self.selected_map_idx == map_idx { + pub fn change_map_selection(&mut self, map_idx: u8, force: bool) { + if self.selected_map_idx == map_idx && !force { return; } godot_print!("change map"); diff --git a/rust/src/net/protocol.rs b/rust/src/net/protocol.rs index 6a4f41f..490ddf9 100644 --- a/rust/src/net/protocol.rs +++ b/rust/src/net/protocol.rs @@ -112,7 +112,7 @@ impl NetworkManager { } Package::SelectMap(map_id) => { if let Some(game) = &mut Game::singleton() { - game.bind_mut().change_map_selection(map_id); + game.bind_mut().change_map_selection(map_id, false); } } Package::GameStarted => { @@ -424,7 +424,7 @@ impl NetworkManager { Package::SelectMap(map_idx) => { if let Some(mut game) = Game::singleton() { if game.bind().opts.is_true(GameOption::AllowAnyMap) { - game.bind_mut().change_map_selection(map_idx); + game.bind_mut().change_map_selection(map_idx, false); } } } diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index 524fd80..068a977 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -388,7 +388,7 @@ impl LobbyPanel { map_selection.select(self.find_idx(id)); } if let Some(game) = &mut Game::singleton() { - game.bind_mut().change_map_selection(id); + game.bind_mut().change_map_selection(id, false); } self.run_deferred(|s| s.update_players(false)); peer.broadcast_reliable(Package::SelectMap(id));