Browse Source

more cleanup

pull/122/head
jake 2 years ago
parent
commit
4a38d94dbb
  1. 1
      Cargo.toml
  2. 2
      src/lib.rs
  3. 4
      src/ship/location.rs
  4. 12
      src/ship/ship.rs

1
Cargo.toml

@ -33,4 +33,3 @@ sqlx = { version = "0.5.10", features = ["runtime-async-std-native-tls", "postgr
strum = "0.19.5"
strum_macros = "0.19"
anyhow = { version = "1.0.47", features = ["backtrace"] }
fix-hidden-lifetime-bug = "0.2.4"

2
src/lib.rs

@ -7,8 +7,6 @@
#![feature(test)]
extern crate test;
extern crate fix_hidden_lifetime_bug;
pub mod common;
pub mod entity;

4
src/ship/location.rs

@ -153,13 +153,9 @@ pub struct ClientLocation {
impl Default for ClientLocation {
fn default() -> ClientLocation {
//const RNONE: Option<Arc<RwLock<Room>>> = None;
//const LINIT: Arc<RwLock<Lobby>> = Arc::new(RwLock::new(Lobby([None; 12])));
ClientLocation {
//lobbies: [LINIT; 15],
lobbies: core::array::from_fn(|_| Arc::new(RwLock::new(Lobby([None; 12])))),
rooms: core::array::from_fn(|_| None),
//rooms: [RNONE; MAX_ROOMS],
client_location: Arc::new(RwLock::new(HashMap::new())),
}
}

12
src/ship/ship.rs

@ -744,7 +744,6 @@ impl<EG: EntityGateway + Clone> ServerState for ShipServerState<EG> {
}
async fn on_disconnect(&mut self, id: ClientId) -> Result<Vec<(ClientId, SendShipPacket)>, anyhow::Error> {
//let client = self.clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
let block = self.blocks.get_from_client(id, &self.clients).await?;
let area_client = block.client_location.get_local_client(id).await?;
let neighbors = block.client_location.get_client_neighbors(id).await?;
@ -763,17 +762,6 @@ impl<EG: EntityGateway + Clone> ServerState for ShipServerState<EG> {
}
};
/*
if let Some(shipgate_sender) = self.shipgate_sender.as_ref() {
shipgate_sender.send(ShipMessage::RemoveUser(client.user.id)).await;
}
block.client_location.remove_client_from_area(id).await;
self.clients.with(id, |client| Box::pin(async move {
self.item_state.remove_character_from_room(&client.character).await
})).await?;
*/
if let Some(mut client) = self.clients.remove(&id).await {
client.user.at_ship = false;
self.entity_gateway.save_user(&client.user).await;

Loading…
Cancel
Save