diff options
Diffstat (limited to 'src/client/core.rs')
| -rw-r--r-- | src/client/core.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/client/core.rs b/src/client/core.rs index 6e9c28b..77761b4 100644 --- a/src/client/core.rs +++ b/src/client/core.rs | |||
| @@ -65,7 +65,7 @@ enum Pending { | |||
| 65 | RouletteSpin, | 65 | RouletteSpin, |
| 66 | BlackjackStart, | 66 | BlackjackStart, |
| 67 | BlackjackAction, | 67 | BlackjackAction, |
| 68 | BlackjackCancel, | 68 | BlackjackForfeit, |
| 69 | Ping, | 69 | Ping, |
| 70 | Echo, | 70 | Echo, |
| 71 | Info, | 71 | Info, |
| @@ -209,12 +209,16 @@ impl ClientCore { | |||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | Some(Pending::BlackjackCancel) => match parse_blackjack_response(reply) { | 212 | Some(Pending::BlackjackForfeit) => match parse_blackjack_response(reply) { |
| 213 | Ok(_) => { | 213 | Ok(state) => { |
| 214 | self.game.end_game(); | 214 | self.game.end_game(); |
| 215 | let message = format!( | ||
| 216 | "Game exited. Active hand forfeited ({} PLN lost).", | ||
| 217 | state.bet | ||
| 218 | ); | ||
| 215 | vec![ | 219 | vec![ |
| 216 | Effect::ClearRegion, | 220 | Effect::ClearRegion, |
| 217 | Effect::Print(vec!["Game exited.".to_string()]), | 221 | Effect::Print(vec![message]), |
| 218 | ] | 222 | ] |
| 219 | } | 223 | } |
| 220 | Err(message) => { | 224 | Err(message) => { |
| @@ -457,10 +461,10 @@ impl ClientCore { | |||
| 457 | Key::CtrlC => vec![Effect::Quit], | 461 | Key::CtrlC => vec![Effect::Quit], |
| 458 | Key::Char('q') => { | 462 | Key::Char('q') => { |
| 459 | if let Some(hand) = hand.filter(|hand| hand.phase == "player") { | 463 | if let Some(hand) = hand.filter(|hand| hand.phase == "player") { |
| 460 | self.game.set_blackjack_status("cancelling"); | 464 | self.game.set_blackjack_status("forfeiting"); |
| 461 | self.pending = Some(Pending::BlackjackCancel); | 465 | self.pending = Some(Pending::BlackjackForfeit); |
| 462 | vec![Effect::SendLine(format!( | 466 | vec![Effect::SendLine(format!( |
| 463 | "BLACKJACK_ACTION {} cancel", | 467 | "BLACKJACK_ACTION {} forfeit", |
| 464 | hand.session_id | 468 | hand.session_id |
| 465 | ))] | 469 | ))] |
| 466 | } else { | 470 | } else { |
