From 40ea0e6c7d84c700cd34c6eca0e5cf7f460b1329 Mon Sep 17 00:00:00 2001 From: Quaternions <krakow20@gmail.com> Date: Sat, 18 Jan 2025 01:31:45 -0800 Subject: [PATCH] rename last_instruction_id to next_instruction_id --- strafe-client/src/session.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/strafe-client/src/session.rs b/strafe-client/src/session.rs index b5b8ba31..17a0d7ee 100644 --- a/strafe-client/src/session.rs +++ b/strafe-client/src/session.rs @@ -99,7 +99,7 @@ impl Recording{ } } pub struct Replay{ - last_instruction_id:usize, + next_instruction_id:usize, recording:Recording, simulation:Simulation, } @@ -109,7 +109,7 @@ impl Replay{ simulation:Simulation, )->Self{ Self{ - last_instruction_id:0, + next_instruction_id:0, recording, simulation, } @@ -117,16 +117,16 @@ impl Replay{ pub fn advance(&mut self,physics_data:&PhysicsData,time_limit:SessionTime){ let mut time=self.simulation.timer.time(time_limit); loop{ - if let Some(ins)=self.recording.instructions.get(self.last_instruction_id){ + if let Some(ins)=self.recording.instructions.get(self.next_instruction_id){ if ins.time<time{ PhysicsContext::run_input_instruction(&mut self.simulation.physics,physics_data,ins.clone()); - self.last_instruction_id+=1; + self.next_instruction_id+=1; }else{ break; } }else{ // loop playback - self.last_instruction_id=0; + self.next_instruction_id=0; // No need to reset physics because the very first instruction is 'Reset' let new_time=self.recording.instructions.first().map_or(PhysicsTime::ZERO,|ins|ins.time); self.simulation.timer.set_time(time_limit,new_time); @@ -340,7 +340,7 @@ impl InstructionConsumer<Instruction<'_>> for Session{ let time=replay.simulation.timer.time(ins.time+SessionTime::from_secs(5)); replay.simulation.timer.set_time(ins.time,time); // resimulate the entire playback lol - replay.last_instruction_id=0; + replay.next_instruction_id=0; }, } },