mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
fix traffic signal editing, broken by the EditCmd refactor
This commit is contained in:
parent
a65ea991e5
commit
044eef2b43
@ -1072,7 +1072,11 @@ impl EditCmd {
|
||||
recalculate_turns(dst_i, map, effects, timer);
|
||||
true
|
||||
}
|
||||
EditCmd::ChangeIntersection { i, ref new, .. } => {
|
||||
EditCmd::ChangeIntersection {
|
||||
i,
|
||||
ref new,
|
||||
ref old,
|
||||
} => {
|
||||
if map.get_i_edit(*i) == new.clone() {
|
||||
return false;
|
||||
}
|
||||
@ -1093,7 +1097,10 @@ impl EditCmd {
|
||||
map.intersections[i.0].intersection_type = IntersectionType::Construction;
|
||||
}
|
||||
}
|
||||
recalculate_turns(*i, map, effects, timer);
|
||||
|
||||
if old == &EditIntersection::Closed || new == &EditIntersection::Closed {
|
||||
recalculate_turns(*i, map, effects, timer);
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -254,22 +254,26 @@ fn make_input_graph(
|
||||
&route.stops[0],
|
||||
)))
|
||||
{
|
||||
let driving_cost = bus_graph
|
||||
.pathfind(
|
||||
&PathRequest {
|
||||
start: map.get_bs(*stop1).driving_pos,
|
||||
end: map.get_bs(*stop2).driving_pos,
|
||||
constraints: PathConstraints::Bus,
|
||||
},
|
||||
map,
|
||||
)
|
||||
.unwrap()
|
||||
.1;
|
||||
input_graph.add_edge(
|
||||
nodes.get(Node::RideBus(*stop1)),
|
||||
nodes.get(Node::RideBus(*stop2)),
|
||||
driving_cost,
|
||||
);
|
||||
if let Some((_, driving_cost)) = bus_graph.pathfind(
|
||||
&PathRequest {
|
||||
start: map.get_bs(*stop1).driving_pos,
|
||||
end: map.get_bs(*stop2).driving_pos,
|
||||
constraints: PathConstraints::Bus,
|
||||
},
|
||||
map,
|
||||
) {
|
||||
input_graph.add_edge(
|
||||
nodes.get(Node::RideBus(*stop1)),
|
||||
nodes.get(Node::RideBus(*stop2)),
|
||||
driving_cost,
|
||||
);
|
||||
} else {
|
||||
panic!(
|
||||
"No bus route from {} to {} now! Prevent this edit",
|
||||
map.get_bs(*stop1).driving_pos,
|
||||
map.get_bs(*stop2).driving_pos
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user