Skip to content

Commit

Permalink
Disable mapvote after vote ends.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiiyya committed Dec 7, 2022
1 parent 6716b2d commit 8245c67
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions battlefox/src/mapvote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct Inner {

#[derive(Debug)]
pub struct Mapvote {
/// Is `None` exactly when mapvote is currently disabled.
inner: Mutex<Option<Inner>>,
mapman: Arc<MapManager>,
vips: Arc<Vips>,
Expand Down Expand Up @@ -1046,12 +1047,14 @@ impl Mapvote {
if let Some(inner) = &mut *lock {
info!("Voting ended. Votes: {:#?}", &inner.votes);
let profile = inner.to_profile();
let anim_override_override = inner.anim_override_override.clone();

// get each player's votes, so we can simulate how the votes go later.
let assignment = inner.to_assignment();

// inner.set_up_new_vote(self.config.n_options, Some(recent_maps));
Some((profile, assignment, inner.anim_override_override.clone()))
// We set the `inner` to None, which will disable the mapvote until it is re-enabled some time.
*lock = None;
Some((profile, assignment, anim_override_override))
} else {
None
}
Expand Down

0 comments on commit 8245c67

Please sign in to comment.