Browse Source

assume get neighbours was successful

pbs
Andy Newjack 5 years ago
parent
commit
49849e7904
  1. 3
      src/ship/ship.rs

3
src/ship/ship.rs

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

Loading…
Cancel
Save