summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/consulter.rs7
-rw-r--r--src/gui.rs9
-rw-r--r--src/main.rs13
3 files changed, 7 insertions, 22 deletions
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<GUIResult> {
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.",