summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstale <redkugelblitzin@gmail.com>2022-06-03 22:39:55 -0300
committerstale <redkugelblitzin@gmail.com>2022-06-03 22:39:55 -0300
commitaeb7beb3f9b154f4aefbaa1c08d822ed572461fb (patch)
tree9023673c4600cf884800c00800f4567b92d2b6d1 /src
parentb1bef4d9bc28c9b4ef57b750368e92cb1878eba7 (diff)
cleaned up client code, more info in game page
Diffstat (limited to 'src')
-rw-r--r--src/conn.rs6
-rw-r--r--src/types.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/conn.rs b/src/conn.rs
index dfd6623..764c573 100644
--- a/src/conn.rs
+++ b/src/conn.rs
@@ -60,9 +60,9 @@ pub async fn lobby(socket: WebSocket, addr: SocketAddr, rinfo: (RoomId,Arc<RwLoc
pub async fn handle_room(streams: (SplitStream<WebSocket>,tokio::sync::mpsc::UnboundedSender<Message>), addr: SocketAddr, rinfo: (RoomId, Arc<RwLock<Room>>)) {
let (mut incoming, tx) = streams;
let (room_id, room) = rinfo;
- let (players, cmd_tx) = {
+ let (players, cmd_tx, room_conf) = {
let room = room.read().await;
- (room.players.clone(), room.cmd_stream.clone())
+ (room.players.clone(), room.cmd_stream.clone(), room.conf.clone())
};
while let Ok(cmd) = incoming.try_next().await {
if let Some(cmd) = cmd {
@@ -154,7 +154,7 @@ pub async fn handle_room(streams: (SplitStream<WebSocket>,tokio::sync::mpsc::Unb
let conn = Conn { addr, tx: tx.clone() };
room.write().await.players.insert_conn(conn, name.clone(), clr).await
};
- tx.send(Message::text(format!("regack {} {uid} {}", name.replace(" ", "&nbsp"), room.read().await.conf.board_conf))).expect("couldn't send register ack");
+ tx.send(Message::text(format!("regack {} {} {} {}", room_conf.name, name.replace(" ", "&nbsp"), uid, room_conf.board_conf))).expect("couldn't send register ack");
if let Err(e) = room.read().await.cmd_stream.send(MetaMove::Dump) {
println!("{room_id} E: couldn't request game dump in behalf of {addr}: {e}");
}
diff --git a/src/types.rs b/src/types.rs
index d467982..2d6ae22 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -24,7 +24,7 @@ pub struct Config {
pub socket_addr: SocketAddr,
}
-#[derive(Debug, Serialize)]
+#[derive(Debug, Serialize, Clone)]
pub struct RoomConf {
pub name: String,
pub player_cap: usize,