aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-13 17:40:16 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-13 17:40:16 +0100
commit6c3bbc12c9c07e64c6719b260ce8c2371c0c27a0 (patch)
tree0ae75971673d864847877e66a6dba028152a13c8 /server/src
parentb5ca6b7732edca22c44255cdf764244f40722e3f (diff)
downloadhurrycurry-6c3bbc12c9c07e64c6719b260ce8c2371c0c27a0.tar
hurrycurry-6c3bbc12c9c07e64c6719b260ce8c2371c0c27a0.tar.bz2
hurrycurry-6c3bbc12c9c07e64c6719b260ce8c2371c0c27a0.tar.zst
fix not updating vote state after cast cooldown
Diffstat (limited to 'server/src')
-rw-r--r--server/src/vote.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/src/vote.rs b/server/src/vote.rs
index 04c554eb..da823f3a 100644
--- a/server/src/vote.rs
+++ b/server/src/vote.rs
@@ -114,6 +114,7 @@ impl VoteState {
}
pub fn tick(&mut self, dt: f32) {
+ let mut need_update = false;
self.initiate_cooldown.retain(|_, c| {
*c -= dt;
*c > 0.
@@ -122,14 +123,16 @@ impl VoteState {
*c -= dt;
if *c <= 0. {
self.voting_players.insert(*p);
+ need_update = true;
}
*c > 0.
});
if let Some(v) = &mut self.active {
v.timeout -= dt;
- if v.timeout <= 0. {
- self.update();
- }
+ need_update |= v.timeout <= 0.
+ }
+ if need_update {
+ self.update();
}
}