From 25b5ac20376655ee7568e5baadb8d41f748a5851 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Wed, 25 Aug 2021 12:31:47 -0700 Subject: [PATCH] Recalculate pathfinding before starting the route tool, since we lazily avoid doing that in the other ungap edit modes. This may become unnecessary when the route tool always does Dijkstra's with custom routing params, but we're not there yet, so it crashes currently --- game/src/ungap/route.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/game/src/ungap/route.rs b/game/src/ungap/route.rs index c2a25adc96..cd1cc8c43a 100644 --- a/game/src/ungap/route.rs +++ b/game/src/ungap/route.rs @@ -17,6 +17,7 @@ use crate::ungap::layers::Layers; pub struct RoutePlanner { layers: Layers, + once: bool, // All of this manages the waypoint input input_panel: Panel, @@ -60,6 +61,7 @@ impl RoutePlanner { let mut rp = RoutePlanner { layers, + once: true, input_panel: Panel::empty(ctx), waypoints: Vec::new(), @@ -310,6 +312,15 @@ impl RoutePlanner { impl State for RoutePlanner { fn event(&mut self, ctx: &mut EventCtx, app: &mut App) -> Transition { + if self.once { + self.once = false; + ctx.loading_screen("apply edits", |_, mut timer| { + app.primary + .map + .recalculate_pathfinding_after_edits(&mut timer); + }); + } + if self.dragging { if ctx.redo_mouseover() { self.update_dragging(ctx, app);