This commit is contained in:
Henri Bourcereau 2024-03-24 18:37:35 +01:00
parent 80d4c256c0
commit 24ddcce233
10 changed files with 188 additions and 10 deletions

View file

@ -165,6 +165,14 @@ impl GameState {
.next()
}
pub fn player_color_by_id(&self, player_id: &PlayerId) -> Option<Color> {
self.players
.iter()
.filter(|(id, _)| *id == player_id)
.map(|(_, player)| player.color)
.next()
}
// ----------------------------------------------------------------------------------
// Rules checks
// ----------------------------------------------------------------------------------