mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
oops, using the wrong router in lookahead, fixed a bug
This commit is contained in:
parent
aa05519539
commit
bb619a9ddd
@ -21,6 +21,8 @@ impl FollowState {
|
||||
let quit = match self {
|
||||
FollowState::Empty => false,
|
||||
// TODO be generic and take an AgentID
|
||||
// TODO when an agent disappears, they sometimes become a car/ped -- follow them
|
||||
// instead
|
||||
FollowState::FollowingCar(id) => {
|
||||
if let Some(c) = sim.get_draw_car(*id, map) {
|
||||
let pt = c.focus_pt();
|
||||
|
@ -69,7 +69,7 @@ impl Car {
|
||||
fn react<R: Rng + ?Sized>(
|
||||
&self,
|
||||
// The high-level plan might change here.
|
||||
router: &mut Router,
|
||||
orig_router: &mut Router,
|
||||
rng: &mut R,
|
||||
map: &Map,
|
||||
time: Tick,
|
||||
@ -86,7 +86,7 @@ impl Car {
|
||||
|
||||
let vehicle = &properties[&self.id];
|
||||
|
||||
if let Some(act) = router.react_before_lookahead(
|
||||
if let Some(act) = orig_router.react_before_lookahead(
|
||||
&view.cars[&self.id],
|
||||
vehicle,
|
||||
time,
|
||||
@ -106,7 +106,7 @@ impl Car {
|
||||
let mut requests: Vec<Request> = Vec::new();
|
||||
let mut current_on = self.on;
|
||||
let mut current_dist_along = self.dist_along;
|
||||
let mut current_router = router.clone();
|
||||
let mut current_router = orig_router.clone();
|
||||
let mut dist_scanned_ahead = 0.0 * si::M;
|
||||
|
||||
loop {
|
||||
@ -161,7 +161,7 @@ impl Car {
|
||||
|
||||
// Stop for something?
|
||||
if let On::Lane(id) = current_on {
|
||||
let maybe_stop_early = router.stop_early_at_dist(
|
||||
let maybe_stop_early = current_router.stop_early_at_dist(
|
||||
current_on,
|
||||
current_dist_along,
|
||||
vehicle,
|
||||
|
Loading…
Reference in New Issue
Block a user