From 810e212b4b255914cfa73e85b52ec23db281c0e3 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 23:06:22 +0100 Subject: v3.1.0: warn on shrink, but let a live round finish --- src/client/core.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/client/core.rs') diff --git a/src/client/core.rs b/src/client/core.rs index 8411d47..95fa050 100644 --- a/src/client/core.rs +++ b/src/client/core.rs @@ -138,6 +138,28 @@ impl ClientCore { self.game.is_in_game() } + /// True while a round is running and leaving would forfeit a reserved bet. + /// The terminal may shrink during one of these without interrupting it. + pub fn is_live_game(&self) -> bool { + match self + .game + .get_current_state() + .map(|state| state.game_type.as_str()) + { + Some("blackjack") => self + .game + .blackjack_state() + .is_some_and(|hand| hand.phase == "player"), + Some("crash") => self.crash_started.is_some(), + _ => false, + } + } + + /// Redraw the current board, for terminal resizes. + pub fn refresh_board(&self) -> Vec { + self.board_effects() + } + pub fn prompt_effect(&self) -> Option { if self.is_in_game() { return None; -- cgit v1.2.3