diff --git a/docs/design/time_travel.md b/docs/design/time_travel.md index 83624cd5f0..f995a6ccbd 100644 --- a/docs/design/time_travel.md +++ b/docs/design/time_travel.md @@ -24,6 +24,6 @@ Some initial steps: - objects_onscreen is the main place! - need to get draw car/ped on lane/turn, so index them that way, maybe implement a trait? - deactivate lots of other plugins while in this mode - - make sim ctrl a proper plugin + = make sim ctrl a proper plugin - anything that accesses sim and looks up agents becomes weird! - interpolate instead of storing everything diff --git a/editor/src/plugins/a_b_tests.rs b/editor/src/plugins/a_b_tests.rs index 8413292ecf..468f27fa5b 100644 --- a/editor/src/plugins/a_b_tests.rs +++ b/editor/src/plugins/a_b_tests.rs @@ -47,7 +47,9 @@ impl Plugin for ABTestManager { let ((new_primary, new_primary_plugins), new_secondary) = launch_test(test, ctx.kml, &ctx.primary.current_flags); *ctx.primary = new_primary; - *ctx.new_primary_plugins = Some(new_primary_plugins); + ctx.primary_plugins.map(|p_plugins| { + *p_plugins = new_primary_plugins; + }); *ctx.secondary = Some(new_secondary); new_state = Some(ABTestManager::Inactive); } diff --git a/editor/src/plugins/map_edits.rs b/editor/src/plugins/map_edits.rs index 5ffc1d7466..c4fd7d5b22 100644 --- a/editor/src/plugins/map_edits.rs +++ b/editor/src/plugins/map_edits.rs @@ -48,7 +48,9 @@ impl Plugin for EditsManager { } if let Some((p, plugins)) = new_primary { *ctx.primary = p; - *ctx.new_primary_plugins = Some(plugins); + ctx.primary_plugins.map(|p_plugins| { + *p_plugins = plugins; + }); } } } diff --git a/editor/src/ui.rs b/editor/src/ui.rs index ae403f8e9a..b6d2ddb1bc 100644 --- a/editor/src/ui.rs +++ b/editor/src/ui.rs @@ -257,7 +257,6 @@ impl PerMapUI { Box::new(plugins::geom_validation::Validator::new()), Box::new(plugins::draw_neighborhoods::DrawNeighborhoodState::new()), Box::new(plugins::scenarios::ScenarioManager::new()), - Box::new(plugins::map_edits::EditsManager::new()), Box::new(plugins::chokepoints::ChokepointsFinder::new()), Box::new(neighborhood_summary), ], @@ -304,6 +303,7 @@ impl UI { Box::new(plugins::diff_all::DiffAllState::new()), Box::new(plugins::diff_worlds::DiffWorldsState::new()), Box::new(plugins::road_editor::RoadEditor::new()), + Box::new(plugins::map_edits::EditsManager::new()), Box::new(plugins::sim_controls::SimController::new()), ], }, @@ -447,7 +447,6 @@ impl UI { } fn run_plugin(&mut self, idx: usize, input: &mut UserInput, osd: &mut Text) -> bool { - let mut new_primary_plugins: Option = None; let active = { let mut ctx = PluginCtx { primary: &mut self.primary, @@ -458,7 +457,6 @@ impl UI { input, osd, kml: &self.kml, - new_primary_plugins: &mut new_primary_plugins, }; let len = self.plugins.list.len(); if idx < len { @@ -468,9 +466,6 @@ impl UI { self.primary_plugins.list[idx - len].event(ctx) } }; - if let Some(new_plugins) = new_primary_plugins { - self.primary_plugins = new_plugins; - } active } @@ -530,8 +525,4 @@ pub struct PluginCtx<'a> { pub input: &'a mut UserInput, pub osd: &'a mut Text, pub kml: &'a Option, - - // Unfortunately we have to use an output parameter here, but it's pretty isolated to - // run_plugin - pub new_primary_plugins: &'a mut Option, }