Browse Source

how did this ever work?

pbs
jake 4 years ago
parent
commit
f96ae557fd
  1. 7
      src/ship/location.rs

7
src/ship/location.rs

@ -146,6 +146,12 @@ impl Default for ClientLocation {
impl ClientLocation {
pub fn add_client_to_lobby(&mut self, id: ClientId, lobby: LobbyId) -> Result<(), JoinLobbyError> {
let l = self.lobbies.get_mut(lobby.0).ok_or(JoinLobbyError::LobbyDoesNotExist)?;
if l.0.iter().filter(|c| c.is_none()).count() == 0 {
return Err(JoinLobbyError::LobbyFull);
}
self.remove_client_from_area(id);
let l = self.lobbies.get_mut(lobby.0).ok_or(JoinLobbyError::LobbyDoesNotExist)?;
let (index, empty_slot) = l.0.iter_mut()
.enumerate()
@ -157,7 +163,6 @@ impl ClientLocation {
local_client: LocalClientId(index),
time_join: SystemTime::now(),
});
self.remove_client_from_area(id);
self.client_location.insert(id, RoomLobby::Lobby(lobby));
Ok(())
}

Loading…
Cancel
Save