From 93bd7e3aa2d2b615018c6d118ef3bf13aa0b0ab1 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Fri, 15 Oct 2021 21:37:43 -0400 Subject: Update dependencies --- src/consulter.rs | 24 ++++++++++++------------ src/game.rs | 31 ++++++++++++++++--------------- src/gui/boardwidget.rs | 28 ++++++++++++++-------------- src/gui/mod.rs | 45 ++++++++++++++++++++++++--------------------- src/main.rs | 30 +++++++++++++++--------------- src/parser.rs | 24 ++++++++++++------------ src/tui.rs | 24 ++++++++++++------------ 7 files changed, 105 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/consulter.rs b/src/consulter.rs index 9cdbca6..d377137 100644 --- a/src/consulter.rs +++ b/src/consulter.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ use std::fs::{remove_file, File}; use std::io::{Error, ErrorKind, Result, Write}; diff --git a/src/game.rs b/src/game.rs index 7e96a2e..c0a25b8 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ use std::collections::HashSet; use std::fmt; @@ -157,9 +157,9 @@ pub type Stack = Vec; /* const-generics would solve a lot of my consistency problems here, - GameState { - ... - board: [Stack; size], +GameState { +... +board: [Stack; size], } but at the time of writing this is not yet part of the language. @@ -375,6 +375,7 @@ impl GameState { - Top stone belongs to player - One or more on each subsequent square - Total number of stones picked up does not exceed the carry capacity + - Enough stones on on square - Direction does not contain a capstone - Wall may only appear on last spot if it's capstone alone that covers - All stones are used up before then end of the board is met diff --git a/src/gui/boardwidget.rs b/src/gui/boardwidget.rs index 2708f21..bbddfb4 100644 --- a/src/gui/boardwidget.rs +++ b/src/gui/boardwidget.rs @@ -1,21 +1,21 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ -use fltk::{app::*, button::*, draw::*}; +use fltk::{button::*, draw::*, enums::Color, prelude::*}; use std::rc::*; use crate::game::*; @@ -233,7 +233,7 @@ impl BoardWidget { pub fn new(button: Button, size: i32) -> BoardWidget { let renderer = Rc::new(BoardRenderer::default().with_size(size).with_org(&button)); let mut g = BoardWidget { button, renderer }; - g.button.draw2(g.generate_draw(&Vec::new())); + g.button.draw(g.generate_draw(&Vec::new())); return g; } diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 1980fdb..3c94abc 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -1,24 +1,28 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ mod boardwidget; use crate::gui::boardwidget::*; -use fltk::{app::*, button::*, menu::*, text::*, window::*}; +use fltk::{ + app::*, button::*, enums::Color, enums::FrameType, enums::Shortcut, menu::*, text::*, window::*, +}; + +use fltk::prelude::*; #[derive(Clone, Copy)] enum GUIMessage { @@ -42,13 +46,12 @@ impl GUI { // TODO: Why is this not the same as /* - let mut window = Window::default() - .with_size(800, 600) - .with_label("Takwrap") - .center_screen(); - */ + let mut window = Window::default() + .with_size(800, 600) + .with_label("Takwrap") + .center_screen(); + */ // Windows made that way are not resizable? - let mut window = DoubleWindow::new(0, 0, 800, 600, "Takwrap").center_screen(); let (sender, receiver) = channel::(); @@ -59,14 +62,14 @@ impl GUI { menu.set_color(Color::Light2); menu.add_emit( "&File/New...\t", - Shortcut::None, + Shortcut::empty(), MenuFlag::Normal, sender, GUIMessage::None, ); menu.add_emit( "&File/Open...\t", - Shortcut::None, + Shortcut::empty(), MenuFlag::Normal, sender, GUIMessage::Test, diff --git a/src/main.rs b/src/main.rs index 1d62045..c3c1839 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,15 +62,15 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["--player1"], Store, "Name of first player, defaults to $USER. See --name-white - below for Black/White assignment.", + below for Black/White assignment.", ); ap.refer(&mut p2_name).add_option( &["--player2"], Store, "Name of second player, defaults to ``Player2'' and is - overridden by the arument ENGINE of --engine when - applicable.", + overridden by the arument ENGINE of --engine when + applicable.", ); ap.refer(&mut start_type_string) @@ -78,10 +78,10 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["-v", "--variant-start"], Store, "Select the rule variant for - the start of play. Valid choices are CPSn, FCS, FES, TPS, - and CZS. The default starting type, which matches the - original rules, is CPS1. See ENGINE below for a warning on - this.", + the start of play. Valid choices are CPSn, FCS, FES, TPS, + and CZS. The default starting type, which matches the + original rules, is CPS1. See ENGINE below for a warning on + this.", ) .metavar("VRNT"); @@ -89,12 +89,12 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["-e", "--engine"], Store, "Name of process which will be used as a computer - opponent. The process must accept a single argument point - to a PTN file of the current game state, and must generate - a single PTN action on STDOUT. The engine will replace the - second player, and the name of player 2 is set to this - argument. Note: ensure that your engine understands the - [Variant XXX] directive if you choose a variant (above).", + opponent. The process must accept a single argument point + to a PTN file of the current game state, and must generate + a single PTN action on STDOUT. The engine will replace the + second player, and the name of player 2 is set to this + argument. Note: ensure that your engine understands the + [Variant XXX] directive if you choose a variant (above).", ); ap.refer(&mut name) @@ -102,7 +102,7 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["--name-white"], Store, "Force the player named NAME to play white. If not - supplied, assignment is ``random''.", + supplied, assignment is ``random''.", ) .metavar("NAME"); @@ -120,7 +120,7 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the ap.refer(&mut terminal).add_option( &["-t", "--terminal"], - Store, + StoreTrue, "Use the terminal user interface instead of the graphical one.", ); diff --git a/src/parser.rs b/src/parser.rs index 1e3ecf4..efcacfb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ use crate::game::*; diff --git a/src/tui.rs b/src/tui.rs index 970b8fe..77e42d9 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see . -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see . + */ extern crate pancurses; -- cgit v1.3.1