diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-02 14:17:55 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-02 14:18:02 +0200 |
commit | 2c2052cf38757e3c77e1e7a6af18af3eb9f3a2eb (patch) | |
tree | f985f1ca2e294aada0cc95ef6761a70ff1fbf20d /server/src/scoreboard.rs | |
parent | e9e1692fb34b661e7c928c9b4b440dcb655eb062 (diff) | |
download | hurrycurry-2c2052cf38757e3c77e1e7a6af18af3eb9f3a2eb.tar hurrycurry-2c2052cf38757e3c77e1e7a6af18af3eb9f3a2eb.tar.bz2 hurrycurry-2c2052cf38757e3c77e1e7a6af18af3eb9f3a2eb.tar.zst |
campaign gate entity
Diffstat (limited to 'server/src/scoreboard.rs')
-rw-r--r-- | server/src/scoreboard.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/scoreboard.rs b/server/src/scoreboard.rs index e546f973..f61b3001 100644 --- a/server/src/scoreboard.rs +++ b/server/src/scoreboard.rs @@ -30,13 +30,13 @@ pub struct ScoreboardStore { } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct Scoreboard { - plays: usize, - best: Vec<ScoreboardEntry>, + pub plays: usize, + pub best: Vec<ScoreboardEntry>, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ScoreboardEntry { - players: Vec<String>, - score: Score, + pub players: Vec<String>, + pub score: Score, } impl ScoreboardStore { @@ -62,6 +62,9 @@ impl ScoreboardStore { rename(buffer_path, path).await?; Ok(()) } + pub fn get<'a>(&'a self, map: &str) -> Option<&'a Scoreboard> { + self.maps.get(map) + } pub fn insert(&mut self, map: &str, players: Vec<String>, score: Score) { let b = self.maps.entry(map.to_owned()).or_default(); b.plays += 1; |