testing test

This commit is contained in:
Quaternions 2024-08-02 12:14:26 -07:00
parent d3bede8b1c
commit a54836a9cb

View File

@ -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<crate::physics::PhysicsInputInstruction>,
},
@ -13,7 +14,7 @@ pub enum Instruction{
//push pushes an instruction to the file
pub struct Worker{
file:Option<BotInstructions>,
file:Option<BotDebug>,
}
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!"),
}
},
}