diff options
| author | tslil clingman <> | 2020-01-28 12:08:35 -0800 |
|---|---|---|
| committer | tslil clingman <> | 2020-01-28 12:08:35 -0800 |
| commit | a51bcf3262350c4316a6bf7eaeee3134d5cd7e31 (patch) | |
| tree | 4dbe5a90d1a7bb32e72eda762cd99c82b3dd1d79 /src/consulter.rs | |
| parent | 04d6efc6eaf31a3ba8c304884725d3c5e9bab9ae (diff) | |
restructured main loop to handle GUI element focus
Diffstat (limited to 'src/consulter.rs')
| -rw-r--r-- | src/consulter.rs | 12 |
1 files changed, 7 insertions, 5 deletions
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<Action> { +pub fn consult_next_action(game: &Game, proc: &str) -> Result<GUIResult> { let file = File::create(FILE_NAME)?; write!(&file, "{}", game)?; @@ -16,9 +17,10 @@ pub fn consult_next_action(game: &Game, proc: &str) -> Result<Action> { 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), + // }, } } |
