mirror of
https://github.com/a-b-street/abstreet.git
synced 2025-01-04 12:36:46 +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);
|
recalculate_turns(dst_i, map, effects, timer);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
EditCmd::ChangeIntersection { i, ref new, .. } => {
|
EditCmd::ChangeIntersection {
|
||||||
|
i,
|
||||||
|
ref new,
|
||||||
|
ref old,
|
||||||
|
} => {
|
||||||
if map.get_i_edit(*i) == new.clone() {
|
if map.get_i_edit(*i) == new.clone() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1093,7 +1097,10 @@ impl EditCmd {
|
|||||||
map.intersections[i.0].intersection_type = IntersectionType::Construction;
|
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
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,22 +254,26 @@ fn make_input_graph(
|
|||||||
&route.stops[0],
|
&route.stops[0],
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
let driving_cost = bus_graph
|
if let Some((_, driving_cost)) = bus_graph.pathfind(
|
||||||
.pathfind(
|
&PathRequest {
|
||||||
&PathRequest {
|
start: map.get_bs(*stop1).driving_pos,
|
||||||
start: map.get_bs(*stop1).driving_pos,
|
end: map.get_bs(*stop2).driving_pos,
|
||||||
end: map.get_bs(*stop2).driving_pos,
|
constraints: PathConstraints::Bus,
|
||||||
constraints: PathConstraints::Bus,
|
},
|
||||||
},
|
map,
|
||||||
map,
|
) {
|
||||||
)
|
input_graph.add_edge(
|
||||||
.unwrap()
|
nodes.get(Node::RideBus(*stop1)),
|
||||||
.1;
|
nodes.get(Node::RideBus(*stop2)),
|
||||||
input_graph.add_edge(
|
driving_cost,
|
||||||
nodes.get(Node::RideBus(*stop1)),
|
);
|
||||||
nodes.get(Node::RideBus(*stop2)),
|
} else {
|
||||||
driving_cost,
|
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