drop droppable instructions

This commit is contained in:
Quaternions 2024-08-05 13:34:30 -07:00
parent 68ccee81b1
commit 97da935d9d

View File

@ -27,9 +27,11 @@ impl BotDebug{
std::mem::drop(self.file);
std::fs::remove_file(self.name)
}
pub fn push(&self,ins:strafesnet_common::instruction::TimedInstruction<strafesnet_common::physics::Instruction>)->Result<(),binrw::Error>{
let ins:TimedPhysicsInstruction=ins.into();
self.file.write_le(&ins)
pub fn push(&mut self,ins:strafesnet_common::instruction::TimedInstruction<strafesnet_common::physics::Instruction>)->Result<(),binrw::Error>{
match TryInto::<TimedPhysicsInstruction>::try_into(ins){
Ok(ins)=>self.file.write_le(&ins),
Err(crate::newtypes::physics::PhysicsInputInstructionError::DropInstruction)=>Ok(()),
}
}
}