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");