From 77db5a7a6bf60dff4550f2b2b113a6b0e6e91236 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 18 Jan 2025 05:22:02 -0800 Subject: [PATCH] tweak instruction collector --- lib/common/src/instruction.rs | 4 +++- strafe-client/src/physics.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/common/src/instruction.rs b/lib/common/src/instruction.rs index d39b899..b2e2709 100644 --- a/lib/common/src/instruction.rs +++ b/lib/common/src/instruction.rs @@ -62,6 +62,7 @@ impl InstructionCollector pub const fn time(&self)->Time{ self.time } + #[inline] pub fn collect(&mut self,instruction:Option>){ if let Some(ins)=instruction{ if ins.time InstructionCollector } } } - pub fn instruction(self)->Option>{ + #[inline] + pub fn take(self)->Option>{ //STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR self.instruction.map(|instruction|TimedInstruction{ time:self.time, diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs index 9896e6b..29758ed 100644 --- a/strafe-client/src/physics.rs +++ b/strafe-client/src/physics.rs @@ -1111,7 +1111,7 @@ impl PhysicsData{ //this is the one who asks fn next_instruction_internal(state:&PhysicsState,data:&PhysicsData,time_limit:Time)->Option>{ //JUST POLLING!!! NO MUTATION - let mut collector = instruction::InstructionCollector::new(time_limit); + let mut collector=instruction::InstructionCollector::new(time_limit); collector.collect(state.next_move_instruction()); @@ -1145,7 +1145,7 @@ impl PhysicsData{ ) ); }); - collector.instruction() + collector.take() }