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 old_neighbors = client_location.get_client_neighbors(id).unwrap();
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 {
RoomLobby::Lobby(lobby) => {
let dialog = SmallDialog::new(String::from("Lobby is full."));
@ -83,7 +80,6 @@ pub fn change_lobby(id: ClientId,
lobby = client_location.add_client_to_next_available_lobby(id, lobby).map_err(|_| ShipError::TooManyClients)?;
}
}
}
}
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)?;

Loading…
Cancel
Save