From e6d1d692415088a058b1b71590992bb0a62d38b8 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 16 Jan 2025 00:51:30 -0800 Subject: [PATCH] delete replay on StopSpectate --- strafe-client/src/session.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/strafe-client/src/session.rs b/strafe-client/src/session.rs index 2f94a93..721402c 100644 --- a/strafe-client/src/session.rs +++ b/strafe-client/src/session.rs @@ -266,8 +266,15 @@ impl InstructionConsumer> for Session{ self.view_state=ViewState::Replay(bot_id); }, Instruction::Control(SessionControlInstruction::StopSpectate)=>{ + let view_state=core::mem::replace(&mut self.view_state,ViewState::Play); + // delete the bot, otherwise it's inaccessible and wastes CPU + match view_state{ + ViewState::Play=>(), + ViewState::Replay(bot_id)=>{ + self.replays.remove(&bot_id); + }, + } _=self.simulation.timer.set_paused(ins.time,false); - self.view_state=ViewState::Play; }, Instruction::Playback(_)=>{ println!("[session] todo: Playback instructions");