From 07abbbd25d36f3f8622f055faebb6eb682501449 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Tue, 16 May 2023 22:15:55 +0300 Subject: [PATCH] fix(client): don't generate new seeds when parsing --- client/src/game_status/parser.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/game_status/parser.rs b/client/src/game_status/parser.rs index 8ba5a77..e54cb19 100644 --- a/client/src/game_status/parser.rs +++ b/client/src/game_status/parser.rs @@ -13,7 +13,6 @@ use fastrand::Rng; use crate::{ api::game::{Action, Command, Game}, game_status::SupplyPile, - seed_gen, }; use super::{GameStatus, PlayerState, PlayerStatus}; @@ -88,6 +87,12 @@ pub fn parse(game: &Game) -> Result { Ok(game_status) } +macro_rules! current_seed { + ($action:ident) => { + $action.seed.parse::().unwrap() + }; +} + fn parse_action(action: &Action, game: &Game, game_status: &mut GameStatus) { // invoker: the one who invoked the action // target: the one who the action affects, may also be the invoker, e.g. draw @@ -165,7 +170,7 @@ fn parse_action(action: &Action, game: &Game, game_status: &mut GameStatus) { &action.invoker, &action.target, &Command::StartTurn {}, - seed_gen!(), + current_seed!(action), ); game_status .actions @@ -186,7 +191,7 @@ fn parse_action(action: &Action, game: &Game, game_status: &mut GameStatus) { &action.target, &action.target, &Command::Draw { amount: 4 }, - seed_gen!(), + current_seed!(action), ); game_status .actions -- 2.44.1