Compare commits

..

No commits in common. "8f45b16d1898d6baf32907a9c3ce34a3281e37ae" and "f3c203dd36eb1001deb8be50c89664206d042c19" have entirely different histories.

3 changed files with 6 additions and 12 deletions

View File

@ -482,11 +482,7 @@ impl Game {
});
}
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");
pub fn change_map_selection(&mut self, map_idx: u8, emit: bool) {
self.selected_map_idx = map_idx;
if let Some(map) = self.maps.get(map_idx as usize) {
self.selected_map = Some(map);
@ -505,7 +501,9 @@ impl Game {
}
}
});
self.run_deferred(move |s| s.signals().on_map_changed().emit(map_idx));
if emit {
self.run_deferred(move |s| s.signals().on_map_changed().emit(map_idx));
}
}
}

View File

@ -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, false);
game.bind_mut().change_map_selection(map_id, true);
}
}
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, false);
game.bind_mut().change_map_selection(map_idx, true);
}
}
}

View File

@ -373,7 +373,6 @@ impl LobbyPanel {
}
pub fn update_map_selection(&mut self, id: u8) {
godot_print!("update map selection");
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
match peer {
PeerKind::Client(peer, addr) => {
@ -384,9 +383,6 @@ impl LobbyPanel {
}
}
PeerKind::Server(peer, _) => {
if let Some(mut map_selection) = self.map_selection.clone() {
map_selection.select(self.find_idx(id));
}
if let Some(game) = &mut Game::singleton() {
game.bind_mut().change_map_selection(id, false);
}