testing test
This commit is contained in:
parent
d3bede8b1c
commit
a54836a9cb
@ -1,8 +1,9 @@
|
|||||||
use strafesnet_snf::bot::BotInstructions;
|
use strafesnet_snf::bot::BotDebug;
|
||||||
|
|
||||||
pub enum Instruction{
|
pub enum Instruction{
|
||||||
//TODO: pass map id
|
//TODO: pass map id
|
||||||
Create,
|
Create,
|
||||||
|
Delete,
|
||||||
Push{
|
Push{
|
||||||
ins:strafesnet_common::instruction::TimedInstruction<crate::physics::PhysicsInputInstruction>,
|
ins:strafesnet_common::instruction::TimedInstruction<crate::physics::PhysicsInputInstruction>,
|
||||||
},
|
},
|
||||||
@ -13,7 +14,7 @@ pub enum Instruction{
|
|||||||
//push pushes an instruction to the file
|
//push pushes an instruction to the file
|
||||||
|
|
||||||
pub struct Worker{
|
pub struct Worker{
|
||||||
file:Option<BotInstructions>,
|
file:Option<BotDebug>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new<'a>(scope:&'a std::thread::Scope<'a,'_>)->crate::worker::QNWorker<'a,Instruction>{
|
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|{
|
crate::worker::QNWorker::new(scope,move|instruction|{
|
||||||
match instruction{
|
match instruction{
|
||||||
Instruction::Create=>{
|
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}=>{
|
Instruction::Push{ins}=>{
|
||||||
match &worker.file{
|
match &worker.file{
|
||||||
Some(file)=>file.push(ins),
|
Some(file)=>file.push(ins).unwrap(),
|
||||||
None=>{
|
None=>println!("no file created!"),
|
||||||
println!("no file created!"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user