diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 22:16:15 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 22:16:15 +0100 |
| commit | bc0de9955c375cf27d52c9934403964205afc182 (patch) | |
| tree | 42799fb426fb0ec164f44c92a63525003c582f35 /src/server/games/roulette.rs | |
| parent | initial connection timeout set to 10s (diff) | |
| download | zagan-bet-bc0de9955c375cf27d52c9934403964205afc182.tar.gz zagan-bet-bc0de9955c375cf27d52c9934403964205afc182.zip | |
formatting
Diffstat (limited to '')
| -rw-r--r-- | src/server/games/roulette.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/games/roulette.rs b/src/server/games/roulette.rs index 7beb8c9..0a58323 100644 --- a/src/server/games/roulette.rs +++ b/src/server/games/roulette.rs | |||
| @@ -65,17 +65,15 @@ impl Game for RouletteGame { | |||
| 65 | 65 | ||
| 66 | match action { | 66 | match action { |
| 67 | "spin" => { | 67 | "spin" => { |
| 68 | if state.phase != GamePhase::WaitingToStart | 68 | if state.phase != GamePhase::WaitingToStart && state.phase != GamePhase::Playing { |
| 69 | && state.phase != GamePhase::Playing | ||
| 70 | { | ||
| 71 | return Err(GameError::InvalidAction( | 69 | return Err(GameError::InvalidAction( |
| 72 | "Cannot spin in current phase".to_string(), | 70 | "Cannot spin in current phase".to_string(), |
| 73 | )); | 71 | )); |
| 74 | } | 72 | } |
| 75 | 73 | ||
| 76 | let payload = params | 74 | let payload = params.first().ok_or(GameError::InvalidAction( |
| 77 | .first() | 75 | "Missing roulette bets".to_string(), |
| 78 | .ok_or(GameError::InvalidAction("Missing roulette bets".to_string()))?; | 76 | ))?; |
| 79 | let bets: Bets = serde_json::from_str(payload) | 77 | let bets: Bets = serde_json::from_str(payload) |
| 80 | .map_err(|error| GameError::InvalidAction(format!("Invalid bets: {error}")))?; | 78 | .map_err(|error| GameError::InvalidAction(format!("Invalid bets: {error}")))?; |
| 81 | 79 | ||
