From 2915d826f744612e0d975282f5bddf13270b9f3f Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 28 Oct 2026 23:19:52 +0100 Subject: v1.1.0: highlight winning symbols on the slots board --- src/client/games/response.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/client/games/response.rs') diff --git a/src/client/games/response.rs b/src/client/games/response.rs index de22a75..d7f9d45 100644 --- a/src/client/games/response.rs +++ b/src/client/games/response.rs @@ -7,6 +7,7 @@ pub struct SpinResult { pub reels: String, pub win_type: String, pub win_lines: Vec, + pub win_cells: Vec, } /// Parse one server reply to `PLAY_START`. @@ -52,11 +53,11 @@ pub fn parse_spin_response(response: &str) -> Result { let win_lines = parts .get(7) - .map(|raw| { - raw.split(',') - .filter_map(|value| value.trim().parse::().ok()) - .collect() - }) + .map(|raw| parse_indices(raw)) + .unwrap_or_default(); + let win_cells = parts + .get(8) + .map(|raw| parse_indices(raw)) .unwrap_or_default(); Ok(SpinResult { @@ -67,5 +68,12 @@ pub fn parse_spin_response(response: &str) -> Result { reels: parts[5].to_string(), win_type: parts[6].to_string(), win_lines, + win_cells, }) } + +fn parse_indices(raw: &str) -> Vec { + raw.split(',') + .filter_map(|value| value.trim().parse::().ok()) + .collect() +} -- cgit v1.2.3