diff options
Diffstat (limited to 'server/src/game.rs')
-rw-r--r-- | server/src/game.rs | 9 |
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 { |