add Output::did_complete() to clarfiy some comparisons
This commit is contained in:
parent
60cde45eea
commit
e439e1cb73
|
@ -97,7 +97,7 @@ fn single(args: cli::SingleRun) -> Result<()> {
|
|||
// be sent so the ctrl-c handler will abort the program
|
||||
std::mem::drop(rx);
|
||||
|
||||
if output.cleared < config.game.goal {
|
||||
if !output.did_complete() {
|
||||
if !prompt_yn(&args.io, "run did not finish, keep it?") {
|
||||
break;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ fn multi(args: cli::MultiRun) -> Result<()> {
|
|||
}
|
||||
}
|
||||
Msg::Output(_id, output) => {
|
||||
if output.cleared == config.game.goal {
|
||||
if output.did_complete() {
|
||||
completed.insert(output.pieces);
|
||||
}
|
||||
|
||||
|
@ -229,8 +229,8 @@ fn write_output_in_dir(dir_path: &Path, output: &output::Output) -> Result<()> {
|
|||
|
||||
let goal = output.config.goal;
|
||||
let pieces = output.pieces;
|
||||
let incomplete = if output.cleared < goal { "I-" } else { "" };
|
||||
let date = date.format("%Y-%m-%d_%H-%M-%S");// "YYYYmmdd-HHMMSS";
|
||||
let incomplete = if !output.did_complete() { "I-" } else { "" };
|
||||
let date = date.format("%Y-%m-%d_%H-%M-%S"); // "YYYYmmdd-HHMMSS";
|
||||
let file_name = format!("{goal}L-{incomplete}{pieces}p-{date}.json");
|
||||
|
||||
let io_args = cli::IoArgs {
|
||||
|
|
|
@ -17,6 +17,12 @@ pub struct Output {
|
|||
pub profile: Option<Profile>,
|
||||
}
|
||||
|
||||
impl Output {
|
||||
pub fn did_complete(&self) -> bool {
|
||||
self.cleared == self.config.goal
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct Move {
|
||||
#[serde(flatten, serialize_with = "ser::placement")]
|
||||
|
|
Loading…
Reference in New Issue