diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-29 21:37:36 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-29 21:37:36 +0200 |
commit | b3a619e0b6b220a5bcf46a9704e2a49c7905b550 (patch) | |
tree | 234fd39c63846a8bfe2d487bb20ead2c3180b92d /server/src/server.rs | |
parent | 30570816b3c460b69e6b410cdddb3e6516b80e22 (diff) | |
download | hurrycurry-b3a619e0b6b220a5bcf46a9704e2a49c7905b550.tar hurrycurry-b3a619e0b6b220a5bcf46a9704e2a49c7905b550.tar.bz2 hurrycurry-b3a619e0b6b220a5bcf46a9704e2a49c7905b550.tar.zst |
Refactor server connection data
Diffstat (limited to 'server/src/server.rs')
-rw-r--r-- | server/src/server.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/src/server.rs b/server/src/server.rs index f97ca69c..a1a849c4 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -40,9 +40,16 @@ use std::{ }; use tokio::sync::broadcast::Sender; +#[derive(Debug, Default)] +pub struct ConnectionData { + pub players: HashSet<PlayerID>, + pub idle: bool, + pub ready: bool, +} + pub struct Server { pub tx: Sender<PacketC>, - pub connections: HashMap<ConnectionID, (HashSet<PlayerID>, bool)>, + pub connections: HashMap<ConnectionID, ConnectionData>, pub paused: bool, pub start_pause_timer: f32, @@ -329,8 +336,7 @@ impl Server { score_changed: false, packet_loopback: VecDeque::new(), last_movement_update: HashMap::default(), - scoreboard: ScoreboardStore::load() - .context("Failed to load scoreboards")?, + scoreboard: ScoreboardStore::load().context("Failed to load scoreboards")?, editor_address: None, paused: false, }) @@ -649,7 +655,7 @@ impl Server { self.score_changed = true; } PacketS::ReplayTick { .. } => return Err(tre!("s.error.packet_not_supported")), - PacketS::Idle { .. } => (), + PacketS::Idle { .. } | PacketS::Ready => (), } Ok(()) } |