diff options
Diffstat (limited to '')
| -rw-r--r-- | src/client/games/roulette.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/games/roulette.rs b/src/client/games/roulette.rs index f0ed816..15cc6ed 100644 --- a/src/client/games/roulette.rs +++ b/src/client/games/roulette.rs | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | use super::traits::{Game, GameState}; | 1 | use super::traits::{Game, GameState}; |
| 2 | use crate::client::view::{RoulettePhase, RouletteView}; | 2 | use crate::client::view::{RoulettePhase, RouletteView}; |
| 3 | use crate::roulette::{BetTarget, Bets, Outside, is_even, is_odd}; | 3 | use crate::roulette::{BetTarget, Bets, Outside, is_even, is_odd}; |
| 4 | use serde::{Deserialize, Serialize}; | ||
| 4 | 5 | ||
| 5 | pub const ROULETTE_BOARD_LINES: usize = 12; | 6 | pub const ROULETTE_BOARD_LINES: usize = 12; |
| 6 | 7 | ||
| @@ -21,7 +22,7 @@ const OUTSIDE_ORDER: [Outside; 6] = [ | |||
| 21 | 22 | ||
| 22 | pub struct RouletteGame; | 23 | pub struct RouletteGame; |
| 23 | 24 | ||
| 24 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 25 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] |
| 25 | pub enum Direction { | 26 | pub enum Direction { |
| 26 | Up, | 27 | Up, |
| 27 | Down, | 28 | Down, |
| @@ -41,7 +42,7 @@ pub enum Direction { | |||
| 41 | /// odd,even line between rows split of the two numbers | 42 | /// odd,even line between rows split of the two numbers |
| 42 | /// even,even corner of four cells corner | 43 | /// even,even corner of four cells corner |
| 43 | /// ``` | 44 | /// ``` |
| 44 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 45 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] |
| 45 | pub enum Cursor { | 46 | pub enum Cursor { |
| 46 | Zero, | 47 | Zero, |
| 47 | Lattice { x: usize, y: usize }, | 48 | Lattice { x: usize, y: usize }, |
| @@ -67,7 +68,9 @@ impl Cursor { | |||
| 67 | match parts.as_slice() { | 68 | match parts.as_slice() { |
| 68 | ["zero"] => Cursor::Zero, | 69 | ["zero"] => Cursor::Zero, |
| 69 | ["lattice", x, y] => match (x.parse::<usize>(), y.parse::<usize>()) { | 70 | ["lattice", x, y] => match (x.parse::<usize>(), y.parse::<usize>()) { |
| 70 | (Ok(x), Ok(y)) if (1..=FELT_X_MAX).contains(&x) && (1..=FELT_Y_MAX).contains(&y) => { | 71 | (Ok(x), Ok(y)) |
| 72 | if (1..=FELT_X_MAX).contains(&x) && (1..=FELT_Y_MAX).contains(&y) => | ||
| 73 | { | ||
| 71 | Cursor::Lattice { x, y } | 74 | Cursor::Lattice { x, y } |
| 72 | } | 75 | } |
| 73 | _ => Cursor::default(), | 76 | _ => Cursor::default(), |
