DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

07abbbd25d36f3f8622f055faebb6eb682501449 — Jonni Liljamo 1 year, 5 months ago 26c7e2e
fix(client): don't generate new seeds when parsing
1 files changed, 8 insertions(+), 3 deletions(-)

M client/src/game_status/parser.rs
M client/src/game_status/parser.rs => client/src/game_status/parser.rs +8 -3
@@ 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<GameStatus, ()> {
    Ok(game_status)
}

macro_rules! current_seed {
    ($action:ident) => {
        $action.seed.parse::<u64>().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