From 3ec29017db35ac335ca98f73f309fc30cb598b11 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 18 May 2021 21:21:59 +0100 Subject: [PATCH] specs: Parse the spec after accessing the game We're going to want to get at the game to get the spec from a bundle. Signed-off-by: Ian Jackson --- daemon/cmdlistener.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/cmdlistener.rs b/daemon/cmdlistener.rs index 5e47e87f..452a7fbc 100644 --- a/daemon/cmdlistener.rs +++ b/daemon/cmdlistener.rs @@ -562,14 +562,14 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>( spec_toml: String, ) -> ExecuteGameInsnResults<'igr, 'ig> { - let spec: toml::Value = spec_toml.parse() - .map_err(|e: toml::de::Error| ME::TomlSyntaxError(e.to_string()))?; - let GameSpec { - pieces, table_size, table_colour, pcaliases, - } = toml_de::from_value(&spec) - .map_err(|e: toml_de::Error| ME::TomlStructureError(e.to_string()))?; - reset_game(cs,ag,ig, Box::new(|_ig, insns|{ + let spec: toml::Value = spec_toml.parse() + .map_err(|e: toml::de::Error| ME::TomlSyntaxError(e.to_string()))?; + let GameSpec { + pieces, table_size, table_colour, pcaliases, + } = toml_de::from_value(&spec) + .map_err(|e: toml_de::Error| ME::TomlStructureError(e.to_string()))?; + // Define new stuff: for (alias, target) in pcaliases.into_iter() { insns.push(MGI::DefinePieceAlias{ alias, target }); -- 2.30.2