diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-29 23:25:13 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-29 23:25:13 +0200 |
commit | d1bbc09e4f88d04b7cda56c1040c305270a3eeda (patch) | |
tree | 6bca87acb63c23852db470c7d44b7629e8e307a2 /server/src/server.rs | |
parent | 66d60ed9ab61efc176808b17fc26445dbf5be705 (diff) | |
download | hurrycurry-d1bbc09e4f88d04b7cda56c1040c305270a3eeda.tar hurrycurry-d1bbc09e4f88d04b7cda56c1040c305270a3eeda.tar.bz2 hurrycurry-d1bbc09e4f88d04b7cda56c1040c305270a3eeda.tar.zst |
Delay announcement when paused
Diffstat (limited to 'server/src/server.rs')
-rw-r--r-- | server/src/server.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/server/src/server.rs b/server/src/server.rs index 22ad5d23..57b26122 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -47,11 +47,17 @@ pub struct ConnectionData { pub ready: bool, } +pub enum AnnounceState { + Queued, + Running(f32), + Done, +} + pub struct Server { pub tx: Sender<PacketC>, pub connections: HashMap<ConnectionID, ConnectionData>, pub paused: bool, - pub announce_timer: f32, + pub announce_state: AnnounceState, pub game: Game, @@ -326,7 +332,7 @@ impl Server { game: Game::default(), index: DataIndex::load().context("Failed to load data index")?, tx, - announce_timer: 0., + announce_state: AnnounceState::Done, packet_out: VecDeque::new(), connections: HashMap::new(), data: Serverdata::default().into(), @@ -386,6 +392,11 @@ impl Server { }); } self.connections.values_mut().for_each(|c| c.ready = false); + self.announce_state = if self.game.lobby { + AnnounceState::Done + } else { + AnnounceState::Queued + }; self.update_paused(); } |