more cleanup
This commit is contained in:
parent
ad694b695e
commit
4a38d94dbb
@ -33,4 +33,3 @@ sqlx = { version = "0.5.10", features = ["runtime-async-std-native-tls", "postgr
|
|||||||
strum = "0.19.5"
|
strum = "0.19.5"
|
||||||
strum_macros = "0.19"
|
strum_macros = "0.19"
|
||||||
anyhow = { version = "1.0.47", features = ["backtrace"] }
|
anyhow = { version = "1.0.47", features = ["backtrace"] }
|
||||||
fix-hidden-lifetime-bug = "0.2.4"
|
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
extern crate fix_hidden_lifetime_bug;
|
|
||||||
|
|
||||||
|
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod entity;
|
pub mod entity;
|
||||||
|
@ -153,13 +153,9 @@ pub struct ClientLocation {
|
|||||||
|
|
||||||
impl Default for ClientLocation {
|
impl Default for ClientLocation {
|
||||||
fn default() -> ClientLocation {
|
fn default() -> ClientLocation {
|
||||||
//const RNONE: Option<Arc<RwLock<Room>>> = None;
|
|
||||||
//const LINIT: Arc<RwLock<Lobby>> = Arc::new(RwLock::new(Lobby([None; 12])));
|
|
||||||
ClientLocation {
|
ClientLocation {
|
||||||
//lobbies: [LINIT; 15],
|
|
||||||
lobbies: core::array::from_fn(|_| Arc::new(RwLock::new(Lobby([None; 12])))),
|
lobbies: core::array::from_fn(|_| Arc::new(RwLock::new(Lobby([None; 12])))),
|
||||||
rooms: core::array::from_fn(|_| None),
|
rooms: core::array::from_fn(|_| None),
|
||||||
//rooms: [RNONE; MAX_ROOMS],
|
|
||||||
client_location: Arc::new(RwLock::new(HashMap::new())),
|
client_location: Arc::new(RwLock::new(HashMap::new())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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> {
|
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 block = self.blocks.get_from_client(id, &self.clients).await?;
|
||||||
let area_client = block.client_location.get_local_client(id).await?;
|
let area_client = block.client_location.get_local_client(id).await?;
|
||||||
let neighbors = block.client_location.get_client_neighbors(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 {
|
if let Some(mut client) = self.clients.remove(&id).await {
|
||||||
client.user.at_ship = false;
|
client.user.at_ship = false;
|
||||||
self.entity_gateway.save_user(&client.user).await;
|
self.entity_gateway.save_user(&client.user).await;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user