diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-03-13 18:04:04 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-03-13 18:04:04 +0100 |
| commit | 0b1fbcf11a0e019d152726e0a40b18b95a97e601 (patch) | |
| tree | 46e53b9a11da024f0ed9bec913dd5457851980f3 /server | |
| parent | 6c3bbc12c9c07e64c6719b260ce8c2371c0c27a0 (diff) | |
| download | hurrycurry-0b1fbcf11a0e019d152726e0a40b18b95a97e601.tar hurrycurry-0b1fbcf11a0e019d152726e0a40b18b95a97e601.tar.bz2 hurrycurry-0b1fbcf11a0e019d152726e0a40b18b95a97e601.tar.zst | |
send vote timeout and remove ballot when players leave
Diffstat (limited to 'server')
| -rw-r--r-- | server/protocol/src/lib.rs | 1 | ||||
| -rw-r--r-- | server/src/vote.rs | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index 903f707a..6d299497 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -327,6 +327,7 @@ pub enum PacketC { initiated_by: PlayerID, subject: VoteSubject, message: Message, + timeout: f32, }, VoteUpdated { total: usize, diff --git a/server/src/vote.rs b/server/src/vote.rs index da823f3a..e9d7c118 100644 --- a/server/src/vote.rs +++ b/server/src/vote.rs @@ -51,6 +51,9 @@ impl VoteState { self.cast_cooldown.remove(&player); self.initiate_cooldown.remove(&player); self.voting_players.remove(&player); + if let Some(a) = &mut self.active { + a.ballots.remove(&player); + } self.update(); } pub fn prime_client(&self, init: &mut Vec<PacketC>) { @@ -59,6 +62,7 @@ impl VoteState { initiated_by: active.initiated_by, subject: active.subject.clone(), message: subject_to_message(&active.subject), + timeout: active.timeout, }); } } @@ -89,6 +93,7 @@ impl VoteState { initiated_by: player, message: subject_to_message(&subject), subject, + timeout: 30., }); self.update(); } |