ran cargo fmt

This commit is contained in:
telastrus 2019-08-08 12:05:38 -04:00
parent 58e8bd4af9
commit 35a3f67e19
4 changed files with 17 additions and 9 deletions

View File

@ -48,7 +48,9 @@ fn main() {
println!("Players online: {:?}", client.get_players());
client.register(comp::Player::new(username, None), password).unwrap();
client
.register(comp::Player::new(username, None), password)
.unwrap();
let (tx, rx) = mpsc::channel();
thread::spawn(move || loop {

View File

@ -8,7 +8,7 @@ pub use specs::{join::Join, saveload::Marker, Entity as EcsEntity, ReadStorage};
use common::{
comp,
msg::{ClientMsg, ClientState, ServerError, ServerInfo, ServerMsg, RequestStateError},
msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg},
net::PostBox,
state::{State, Uid},
terrain::{block::Block, chonk::ChonkMetrics, TerrainChunk, TerrainChunkSize},
@ -132,10 +132,12 @@ impl Client {
}
/// Request a state transition to `ClientState::Registered`.
pub fn register(&mut self, player: comp::Player, password: String) /*-> Result<(), Error>*/ {
self.postbox.send_message(ClientMsg::Register { player, password });
pub fn register(&mut self, player: comp::Player, password: String) /*-> Result<(), Error>*/
{
self.postbox
.send_message(ClientMsg::Register { player, password });
self.client_state = ClientState::Pending;
/*loop {
/*loop {
match self.postbox.next_message() {
Some(ServerMsg::StateAnswer(Err((RequestStateError::Denied, _)))) => {
println!("Got a bad");
@ -149,7 +151,7 @@ impl Client {
println!("Got unusual message: {:?}", x);
}
None => { println!("Got nothing?"); },
}
}*/
}

View File

@ -26,7 +26,7 @@ use log::debug;
use rand::Rng;
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
use std::{
collections::{HashSet, HashMap},
collections::{HashMap, HashSet},
i32,
net::SocketAddr,
sync::{mpsc, Arc},
@ -535,7 +535,6 @@ impl Server {
break;
}
} else {
player.alias, password);
accounts.insert(player.alias.clone(), password);
}
match client.client_state {

View File

@ -30,7 +30,12 @@ pub struct ClientInit {
rx: Receiver<Result<Client, Error>>,
}
impl ClientInit {
pub fn new(connection_args: (String, u16, bool), player: comp::Player, password: String, wait: bool) -> Self {
pub fn new(
connection_args: (String, u16, bool),
player: comp::Player,
password: String,
wait: bool,
) -> Self {
let (server_address, default_port, prefer_ipv6) = connection_args;
let (tx, rx) = channel();