Fix selecting default map
This commit is contained in:
parent
b8b42e31ac
commit
8f45b16d18
@ -111,7 +111,7 @@ impl CliParser {
|
|||||||
});
|
});
|
||||||
if let Some((map_idx, _)) = map {
|
if let Some((map_idx, _)) = map {
|
||||||
game.bind_mut().forced_map_selection = true;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -482,8 +482,8 @@ impl Game {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn change_map_selection(&mut self, map_idx: u8) {
|
pub fn change_map_selection(&mut self, map_idx: u8, force: bool) {
|
||||||
if self.selected_map_idx == map_idx {
|
if self.selected_map_idx == map_idx && !force {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
godot_print!("change map");
|
godot_print!("change map");
|
||||||
|
|||||||
@ -112,7 +112,7 @@ impl NetworkManager {
|
|||||||
}
|
}
|
||||||
Package::SelectMap(map_id) => {
|
Package::SelectMap(map_id) => {
|
||||||
if let Some(game) = &mut Game::singleton() {
|
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 => {
|
Package::GameStarted => {
|
||||||
@ -424,7 +424,7 @@ impl NetworkManager {
|
|||||||
Package::SelectMap(map_idx) => {
|
Package::SelectMap(map_idx) => {
|
||||||
if let Some(mut game) = Game::singleton() {
|
if let Some(mut game) = Game::singleton() {
|
||||||
if game.bind().opts.is_true(GameOption::AllowAnyMap) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,7 +388,7 @@ impl LobbyPanel {
|
|||||||
map_selection.select(self.find_idx(id));
|
map_selection.select(self.find_idx(id));
|
||||||
}
|
}
|
||||||
if let Some(game) = &mut Game::singleton() {
|
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));
|
self.run_deferred(|s| s.update_players(false));
|
||||||
peer.broadcast_reliable(Package::SelectMap(id));
|
peer.broadcast_reliable(Package::SelectMap(id));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user