mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +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 {
|
let quit = match self {
|
||||||
FollowState::Empty => false,
|
FollowState::Empty => false,
|
||||||
// TODO be generic and take an AgentID
|
// TODO be generic and take an AgentID
|
||||||
|
// TODO when an agent disappears, they sometimes become a car/ped -- follow them
|
||||||
|
// instead
|
||||||
FollowState::FollowingCar(id) => {
|
FollowState::FollowingCar(id) => {
|
||||||
if let Some(c) = sim.get_draw_car(*id, map) {
|
if let Some(c) = sim.get_draw_car(*id, map) {
|
||||||
let pt = c.focus_pt();
|
let pt = c.focus_pt();
|
||||||
|
@ -69,7 +69,7 @@ impl Car {
|
|||||||
fn react<R: Rng + ?Sized>(
|
fn react<R: Rng + ?Sized>(
|
||||||
&self,
|
&self,
|
||||||
// The high-level plan might change here.
|
// The high-level plan might change here.
|
||||||
router: &mut Router,
|
orig_router: &mut Router,
|
||||||
rng: &mut R,
|
rng: &mut R,
|
||||||
map: &Map,
|
map: &Map,
|
||||||
time: Tick,
|
time: Tick,
|
||||||
@ -86,7 +86,7 @@ impl Car {
|
|||||||
|
|
||||||
let vehicle = &properties[&self.id];
|
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],
|
&view.cars[&self.id],
|
||||||
vehicle,
|
vehicle,
|
||||||
time,
|
time,
|
||||||
@ -106,7 +106,7 @@ impl Car {
|
|||||||
let mut requests: Vec<Request> = Vec::new();
|
let mut requests: Vec<Request> = Vec::new();
|
||||||
let mut current_on = self.on;
|
let mut current_on = self.on;
|
||||||
let mut current_dist_along = self.dist_along;
|
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;
|
let mut dist_scanned_ahead = 0.0 * si::M;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -161,7 +161,7 @@ impl Car {
|
|||||||
|
|
||||||
// Stop for something?
|
// Stop for something?
|
||||||
if let On::Lane(id) = current_on {
|
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_on,
|
||||||
current_dist_along,
|
current_dist_along,
|
||||||
vehicle,
|
vehicle,
|
||||||
|
Loading…
Reference in New Issue
Block a user