From a51bcf3262350c4316a6bf7eaeee3134d5cd7e31 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Tue, 28 Jan 2020 12:08:35 -0800 Subject: restructured main loop to handle GUI element focus --- src/consulter.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/consulter.rs') diff --git a/src/consulter.rs b/src/consulter.rs index a8e666f..7c7bca7 100644 --- a/src/consulter.rs +++ b/src/consulter.rs @@ -3,11 +3,12 @@ use std::io::{Error, ErrorKind, Result, Write}; use std::process::Command; use crate::game::*; +use crate::gui::*; use crate::parser::*; const FILE_NAME: &str = "/tmp/takwrap_ptn_consult.ptn"; -pub fn consult_next_action(game: &Game, proc: &str) -> Result { +pub fn consult_next_action(game: &Game, proc: &str) -> Result { let file = File::create(FILE_NAME)?; write!(&file, "{}", game)?; @@ -16,9 +17,10 @@ pub fn consult_next_action(game: &Game, proc: &str) -> Result { match String::from_utf8(output.stdout) { Err(e) => Err(Error::new(ErrorKind::InvalidData, e)), - Ok(string) => match parse_action(game.query_stone_owner(), &string.trim()) { - Err(string) => Err(Error::new(ErrorKind::InvalidData, string)), - Ok(action) => Ok(action), - }, + Ok(raw) => Ok(GUIResult::Raw(raw)), + // Ok(string) => match parse_action(game.query_stone_owner(), &string.trim()) { + // Err(string) => Err(Error::new(ErrorKind::InvalidData, string)), + // Ok(action) => GUIResult::Selected(action), + // }, } } -- cgit v1.3.1