diff --git a/strafe-client/src/physics_worker.rs b/strafe-client/src/physics_worker.rs index fcfd42e..9c119de 100644 --- a/strafe-client/src/physics_worker.rs +++ b/strafe-client/src/physics_worker.rs @@ -38,43 +38,29 @@ pub fn new<'a>( } macro_rules! run_graphics_worker_instruction{ ($instruction:expr)=>{ - if let Some(instruction)=$instruction{ - graphics_worker.send(instruction).unwrap(); - } + graphics_worker.send($instruction).unwrap(); }; } match ins.instruction{ Instruction::Input(unbuffered_instruction)=>{ - let ins_session=SessionInstruction::Input(unbuffered_instruction); - run_session_instruction!(ins.time,ins_session); - let ins_graphics=None; - run_graphics_worker_instruction!(ins_graphics); + run_session_instruction!(ins.time,SessionInstruction::Input(unbuffered_instruction)); }, Instruction::SetPaused(paused)=>{ - let ins_session=SessionInstruction::SetPaused(paused); - run_session_instruction!(ins.time,ins_session); - let ins_graphics=None; - run_graphics_worker_instruction!(ins_graphics); + run_session_instruction!(ins.time,SessionInstruction::SetPaused(paused)); }, Instruction::Render=>{ - let ins_session=SESSION_INSTRUCTION_IDLE; - run_session_instruction!(ins.time,ins_session); + run_session_instruction!(ins.time,SESSION_INSTRUCTION_IDLE); let frame_state=session.get_frame_state(ins.time); - let ins_graphics=Some(GraphicsInstruction::Render(frame_state)); - run_graphics_worker_instruction!(ins_graphics); + run_graphics_worker_instruction!(GraphicsInstruction::Render(frame_state)); }, Instruction::Resize(physical_size)=>{ - let ins_session=SESSION_INSTRUCTION_IDLE; - run_session_instruction!(ins.time,ins_session); + run_session_instruction!(ins.time,SESSION_INSTRUCTION_IDLE); let user_settings=session.user_settings().clone(); - let ins_graphics=Some(GraphicsInstruction::Resize(physical_size,user_settings)); - run_graphics_worker_instruction!(ins_graphics); + run_graphics_worker_instruction!(GraphicsInstruction::Resize(physical_size,user_settings)); }, Instruction::ChangeMap(complete_map)=>{ - let ins_session=SessionInstruction::ChangeMap(&complete_map); - run_session_instruction!(ins.time,ins_session); - let ins_graphics=Some(GraphicsInstruction::ChangeMap(complete_map)); - run_graphics_worker_instruction!(ins_graphics); + run_session_instruction!(ins.time,SessionInstruction::ChangeMap(&complete_map)); + run_graphics_worker_instruction!(GraphicsInstruction::ChangeMap(complete_map)); }, } })