|
@ -91,15 +91,15 @@ pub async fn change_lobby<EG: EntityGateway>(id: ClientId, |
|
|
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);
|
|
|
if let Err(_) = client_location.add_client_to_lobby(id, lobby) {
|
|
|
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."));
|
|
|
|
|
|
return Ok(vec![(id, SendShipPacket::SmallDialog(dialog))])
|
|
|
|
|
|
}
|
|
|
|
|
|
RoomLobby::Room(_room) => {
|
|
|
|
|
|
lobby = client_location.add_client_to_next_available_lobby(id, lobby).map_err(|_| ShipError::TooManyClients)?;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
match prev_area {
|
|
|
|
|
|
RoomLobby::Lobby(_lobby) => {
|
|
|
|
|
|
let dialog = SmallDialog::new(String::from("Lobby is full."));
|
|
|
|
|
|
return Ok(vec![(id, SendShipPacket::SmallDialog(dialog))])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
RoomLobby::Room(_room) => {
|
|
|
|
|
|
lobby = client_location.add_client_to_next_available_lobby(id, lobby).map_err(|_| ShipError::TooManyClients)?;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
item_manager.load_character(entity_gateway, &client.character).await;
|
|
|
item_manager.load_character(entity_gateway, &client.character).await;
|
|
|
let join_lobby = packet::builder::lobby::join_lobby(id, lobby, client_location, clients, item_manager, level_table)?;
|
|
|
let join_lobby = packet::builder::lobby::join_lobby(id, lobby, client_location, clients, item_manager, level_table)?;
|
|
|