assume get neighbours was successful

This commit is contained in:
Andy Newjack 2020-05-01 18:44:59 -03:00
parent 7a3f0db3bf
commit 49849e7904

View File

@ -331,12 +331,13 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> {
}
fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendShipPacket)> {
// TODO: don't unwrap!
let client = self.client_location.get_local_client(id).unwrap();
let neighbors = self.client_location.get_client_neighbors(id).unwrap();
let pkt = match self.client_location.get_area(id).unwrap() {
RoomLobby::Room(room) => {
if let 0 = neighbors.len() {
if neighbors.len() == 0 {
self.rooms[room.0] = None;
}
let leader = self.client_location.get_room_leader(room).unwrap();