Browse Source

better code

pbs
mht8355 5 years ago
parent
commit
7c6cdd30cc
  1. 6
      src/ship/packet/handler/lobby.rs

6
src/ship/packet/handler/lobby.rs

@ -70,10 +70,7 @@ pub fn change_lobby(id: ClientId,
let leave_lobby = packet::builder::lobby::remove_from_lobby(id, client_location)?; let leave_lobby = packet::builder::lobby::remove_from_lobby(id, client_location)?;
let old_neighbors = client_location.get_client_neighbors(id).unwrap(); let old_neighbors = client_location.get_client_neighbors(id).unwrap();
let mut lobby = LobbyId(requested_lobby as usize); let mut lobby = LobbyId(requested_lobby as usize);
match client_location.add_client_to_lobby(id, lobby) {
Ok(lobby) => {
}
Err(err) => {
if let Err(_) = client_location.add_client_to_lobby(id, lobby) {
match prev_area { match prev_area {
RoomLobby::Lobby(lobby) => { RoomLobby::Lobby(lobby) => {
let dialog = SmallDialog::new(String::from("Lobby is full.")); let dialog = SmallDialog::new(String::from("Lobby is full."));
@ -84,7 +81,6 @@ pub fn change_lobby(id: ClientId,
} }
} }
} }
}
let join_lobby = packet::builder::lobby::join_lobby(id, lobby, client_location, clients, level_table)?; let join_lobby = packet::builder::lobby::join_lobby(id, lobby, client_location, clients, level_table)?;
let addto = packet::builder::lobby::add_to_lobby(id, lobby, client_location, clients, level_table)?; let addto = packet::builder::lobby::add_to_lobby(id, lobby, client_location, clients, level_table)?;
let neighbors = client_location.get_client_neighbors(id).unwrap(); let neighbors = client_location.get_client_neighbors(id).unwrap();

Loading…
Cancel
Save