From a54836a9cb2dff6b4f9735db88bb7bd4e4e85cbb Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 2 Aug 2024 12:14:26 -0700 Subject: [PATCH] testing test --- src/bot_worker.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/bot_worker.rs b/src/bot_worker.rs index 6a42915..efdad78 100644 --- a/src/bot_worker.rs +++ b/src/bot_worker.rs @@ -1,8 +1,9 @@ -use strafesnet_snf::bot::BotInstructions; +use strafesnet_snf::bot::BotDebug; pub enum Instruction{ //TODO: pass map id Create, + Delete, Push{ ins:strafesnet_common::instruction::TimedInstruction, }, @@ -13,7 +14,7 @@ pub enum Instruction{ //push pushes an instruction to the file pub struct Worker{ - file:Option, + file:Option, } pub fn new<'a>(scope:&'a std::thread::Scope<'a,'_>)->crate::worker::QNWorker<'a,Instruction>{ @@ -23,14 +24,18 @@ pub fn new<'a>(scope:&'a std::thread::Scope<'a,'_>)->crate::worker::QNWorker<'a, crate::worker::QNWorker::new(scope,move|instruction|{ match instruction{ Instruction::Create=>{ - worker.file=Some(BotIntructions::new("hi.snfb")) + worker.file=Some(BotDebug::new().unwrap()) }, + Instruction::Delete=>{ + match worker.file.take(){ + Some(file)=>file.delete().unwrap(), + None=>println!("no file created!"), + } + } Instruction::Push{ins}=>{ match &worker.file{ - Some(file)=>file.push(ins), - None=>{ - println!("no file created!"), - } + Some(file)=>file.push(ins).unwrap(), + None=>println!("no file created!"), } }, }