summaryrefslogtreecommitdiffstats
path: root/src/client/core.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/client/core.rs22
1 files changed, 22 insertions, 0 deletions
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 {
138 self.game.is_in_game() 138 self.game.is_in_game()
139 } 139 }
140 140
141 /// True while a round is running and leaving would forfeit a reserved bet.
142 /// The terminal may shrink during one of these without interrupting it.
143 pub fn is_live_game(&self) -> bool {
144 match self
145 .game
146 .get_current_state()
147 .map(|state| state.game_type.as_str())
148 {
149 Some("blackjack") => self
150 .game
151 .blackjack_state()
152 .is_some_and(|hand| hand.phase == "player"),
153 Some("crash") => self.crash_started.is_some(),
154 _ => false,
155 }
156 }
157
158 /// Redraw the current board, for terminal resizes.
159 pub fn refresh_board(&self) -> Vec<Effect> {
160 self.board_effects()
161 }
162
141 pub fn prompt_effect(&self) -> Option<Effect> { 163 pub fn prompt_effect(&self) -> Option<Effect> {
142 if self.is_in_game() { 164 if self.is_in_game() {
143 return None; 165 return None;