remove unwraps
This commit is contained in:
parent
49aee7af26
commit
c8a6823b82
@ -71,7 +71,7 @@ pub fn change_lobby(id: ClientId,
|
||||
}
|
||||
},
|
||||
RoomLobby::Room(old_room) => {
|
||||
if client_location.get_client_neighbors(id).unwrap().len() == 0 {
|
||||
if client_location.get_client_neighbors(id).map_err(|err| -> ClientLocationError {err.into()})?.len() == 0 {
|
||||
ship_rooms[old_room.0] = None;
|
||||
}
|
||||
},
|
||||
|
@ -336,9 +336,9 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> {
|
||||
|
||||
let pkt = match self.client_location.get_area(id).unwrap() {
|
||||
RoomLobby::Room(room) => {
|
||||
if self.client_location.get_client_neighbors(id).unwrap().len() == 0 {
|
||||
self.rooms[room.0] = None;
|
||||
}
|
||||
self.client_location.get_client_neighbors(id).map(|x| if x.len() == 0 {
|
||||
self.rooms[room.0] = None
|
||||
});
|
||||
let leader = self.client_location.get_room_leader(room).unwrap();
|
||||
SendShipPacket::LeaveRoom(LeaveRoom::new(client.local_client.id(), leader.local_client.id()))
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user