bots : wip 2 bots handling
This commit is contained in:
parent
71992ccf7c
commit
2fe2f66c13
2 changed files with 52 additions and 17 deletions
|
|
@ -612,6 +612,21 @@ pub enum GameEvent {
|
|||
},
|
||||
}
|
||||
|
||||
impl GameEvent {
|
||||
pub fn player_id(&self) -> Option<PlayerId> {
|
||||
match self {
|
||||
Self::PlayerJoined { player_id, name } => Some(*player_id),
|
||||
Self::PlayerDisconnected { player_id } => Some(*player_id),
|
||||
Self::Roll { player_id } => Some(*player_id),
|
||||
Self::RollResult { player_id, dice } => Some(*player_id),
|
||||
Self::Mark { player_id, points } => Some(*player_id),
|
||||
Self::Go { player_id } => Some(*player_id),
|
||||
Self::Move { player_id, moves } => Some(*player_id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue