From 08269639606c0481037cbde7ebaf2e0455460883 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 18:43:09 +0100 Subject: v2.2.1: forfeit blackjack bets when leaving or disconnecting --- src/client/core.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/client/core.rs') 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 { RouletteSpin, BlackjackStart, BlackjackAction, - BlackjackCancel, + BlackjackForfeit, Ping, Echo, Info, @@ -209,12 +209,16 @@ impl ClientCore { } } } - Some(Pending::BlackjackCancel) => match parse_blackjack_response(reply) { - Ok(_) => { + Some(Pending::BlackjackForfeit) => match parse_blackjack_response(reply) { + Ok(state) => { self.game.end_game(); + let message = format!( + "Game exited. Active hand forfeited ({} PLN lost).", + state.bet + ); vec![ Effect::ClearRegion, - Effect::Print(vec!["Game exited.".to_string()]), + Effect::Print(vec![message]), ] } Err(message) => { @@ -457,10 +461,10 @@ impl ClientCore { Key::CtrlC => vec![Effect::Quit], Key::Char('q') => { if let Some(hand) = hand.filter(|hand| hand.phase == "player") { - self.game.set_blackjack_status("cancelling"); - self.pending = Some(Pending::BlackjackCancel); + self.game.set_blackjack_status("forfeiting"); + self.pending = Some(Pending::BlackjackForfeit); vec![Effect::SendLine(format!( - "BLACKJACK_ACTION {} cancel", + "BLACKJACK_ACTION {} forfeit", hand.session_id ))] } else { -- cgit v1.2.3