From 9fbdf6f32c18a938679cb245dbfd0434f7703b3d Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Wed, 29 Jan 2020 10:43:08 -0800 Subject: Small bugfix and cleanup --- src/consulter.rs | 7 +------ src/gui.rs | 9 --------- src/main.rs | 13 ++++++------- 3 files changed, 7 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/consulter.rs b/src/consulter.rs index 7c7bca7..091eec0 100644 --- a/src/consulter.rs +++ b/src/consulter.rs @@ -4,7 +4,6 @@ use std::process::Command; use crate::game::*; use crate::gui::*; -use crate::parser::*; const FILE_NAME: &str = "/tmp/takwrap_ptn_consult.ptn"; @@ -17,10 +16,6 @@ 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(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), - // }, + Ok(raw) => Ok(GUIResult::Raw(raw.trim().to_string())), } } diff --git a/src/gui.rs b/src/gui.rs index 4899bb7..95bc8ee 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -12,15 +12,6 @@ pub enum GUIResult { Raw(String), } -impl GUIResult { - pub fn is_raw(&self) -> bool { - match self { - GUIResult::Raw(_) => true, - _ => false, - } - } -} - pub struct GameLog { action_window: Window, pieces_window: Window, diff --git a/src/main.rs b/src/main.rs index 9ddaa50..5fe8c18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,13 +14,12 @@ use crate::parser::*; use argparse::*; use chrono::Local; use std::env; -use std::io::Error; use std::time::SystemTime; struct GUI { screen: Window, - width: i32, - height: i32, + // width: i32, + // height: i32, game_log: GameLog, message_log: MessageLog, action_entry: ActionEntry, @@ -100,8 +99,8 @@ fn init_gui(size: u8) -> GUI { GUI { screen, - width, - height, + // width, + // height, game_log, message_log, action_entry, @@ -258,7 +257,8 @@ fn main() { let act = parse_action(stone_owner, &raw); match act { Err(err) => { - gui.message_log.log_error(format!("Input {}: {}", raw, err)); + gui.message_log + .log_error(format!("Input \"{}\": {}", raw, err)); if engine_turn { break; } @@ -278,7 +278,6 @@ fn main() { match game.perform_action(act) { Err(e) => { gui.message_log.log_error(e); - let current = game.query_current_player(); if engine_turn { gui.message_log.log_error(String::from( "Error: external and internal game states disagree.", -- cgit v1.3.1