diff --git a/game/src/common/mod.rs b/game/src/common/mod.rs index 0b6bf37401..b6316bb3b8 100644 --- a/game/src/common/mod.rs +++ b/game/src/common/mod.rs @@ -41,11 +41,8 @@ impl CommonState { app: &mut App, ctx_actions: &mut dyn ContextualActions, ) -> Option { - if ctx.input.pressed(lctrl(Key::S)) { - app.opts.dev = !app.opts.dev; - } - if ctx.input.pressed(lctrl(Key::J)) { - return Some(Transition::Push(warp::DebugWarp::new_state(ctx))); + if let Some(t) = CommonState::debug_actions(ctx, app) { + return Some(t); } // Layers can be launched from many places, many of which don't have a way of getting at @@ -304,6 +301,17 @@ impl CommonState { pub fn info_panel_open(&self, app: &App) -> Option { self.info_panel.as_ref().and_then(|i| i.active_id(app)) } + + /// Allow toggling of dev mode and warping to an object by ID. + pub fn debug_actions(ctx: &mut EventCtx, app: &mut App) -> Option { + if ctx.input.pressed(lctrl(Key::S)) { + app.opts.dev = !app.opts.dev; + } + if ctx.input.pressed(lctrl(Key::J)) { + return Some(Transition::Push(warp::DebugWarp::new_state(ctx))); + } + None + } } // TODO Kinda misnomer diff --git a/game/src/edit/mod.rs b/game/src/edit/mod.rs index 59e156a8e0..dc3201eef6 100644 --- a/game/src/edit/mod.rs +++ b/game/src/edit/mod.rs @@ -154,6 +154,10 @@ impl State for EditMode { } } + if let Some(t) = CommonState::debug_actions(ctx, app) { + return t; + } + ctx.canvas_movement(); // Restrict what can be selected. if ctx.redo_mouseover() { diff --git a/game/src/edit/traffic_signals/gmns.rs b/game/src/edit/traffic_signals/gmns.rs index 68f17d1af5..6dde3679b4 100644 --- a/game/src/edit/traffic_signals/gmns.rs +++ b/game/src/edit/traffic_signals/gmns.rs @@ -115,27 +115,37 @@ pub fn import_all(ctx: &mut EventCtx, app: &mut App, path: &str) -> Box { - info!("Success at {}", i); - successes += 1; - edits.commands.push(EditCmd::ChangeIntersection { - i, - old: app.primary.map.get_i_edit(i), - new: EditIntersection::TrafficSignal(signal.export(&app.primary.map)), - }); - } - Err(err) => { - error!("Failure at {}: {}", i, err); - failures += 1; + ctx.loading_screen("import signal timing", |_, timer| { + timer.start_iter("import", all_signals.len()); + for i in all_signals { + timer.next(); + match import(&app.primary.map, i, path) + .and_then(|signal| signal.validate().map(|_| signal)) + { + Ok(signal) => { + info!("Success at {}", i); + successes += 1; + edits.commands.push(EditCmd::ChangeIntersection { + i, + old: app.primary.map.get_i_edit(i), + new: EditIntersection::TrafficSignal(signal.export(&app.primary.map)), + }); + } + Err(err) => { + error!("Failure at {}: {}", i, err); + if err.to_string().contains("no matches for") { + failures_no_match += 1; + } else { + failures_other += 1; + } + } } } - } + }); apply_map_edits(ctx, app, edits); @@ -144,7 +154,8 @@ pub fn import_all(ctx: &mut EventCtx, app: &mut App, path: &str) -> Box