aboutsummaryrefslogtreecommitdiff
path: root/server/src/game.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-10 21:54:03 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-10 21:54:03 +0200
commit61533450cba864f49653aed4021fedf39477c8fd (patch)
tree129e99eb7b6ab34cfd098fa854463b9d1a41f5b8 /server/src/game.rs
parent552711488539d651283bb8573a35aff737c8b132 (diff)
downloadhurrycurry-61533450cba864f49653aed4021fedf39477c8fd.tar
hurrycurry-61533450cba864f49653aed4021fedf39477c8fd.tar.bz2
hurrycurry-61533450cba864f49653aed4021fedf39477c8fd.tar.zst
quick reload command
Diffstat (limited to 'server/src/game.rs')
-rw-r--r--server/src/game.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/src/game.rs b/server/src/game.rs
index 5cdf8cd4..e13a2f93 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -63,7 +63,7 @@ pub struct Player {
}
pub struct Game {
- data: Arc<Gamedata>,
+ pub data: Arc<Gamedata>,
tiles: HashMap<IVec2, Tile>,
pub players: HashMap<PlayerID, Player>,
packet_out: VecDeque<PacketC>,
@@ -544,6 +544,13 @@ impl Game {
return self.end.map(|t| t < Instant::now()).unwrap_or_default();
}
+
+ pub fn count_chefs(&self) -> usize {
+ self.players
+ .iter()
+ .map(|(_, p)| if p.character > 0 { 1 } else { 0 })
+ .sum()
+ }
}
impl From<TileIndex> for Tile {