mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-28 08:53:26 +03:00
solve the problem with bikes entering too short
This commit is contained in:
parent
17a0b57644
commit
6b3a77c9ec
@ -524,6 +524,7 @@ impl Spawner {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This might fail!
|
||||||
pub fn start_trip_using_bike(
|
pub fn start_trip_using_bike(
|
||||||
&mut self,
|
&mut self,
|
||||||
at: Tick,
|
at: Tick,
|
||||||
@ -542,6 +543,11 @@ impl Spawner {
|
|||||||
let b = map.get_b(start_bldg);
|
let b = map.get_b(start_bldg);
|
||||||
let pos = b.front_path.sidewalk;
|
let pos = b.front_path.sidewalk;
|
||||||
if pos.dist_along() < MAX_BIKE_LENGTH {
|
if pos.dist_along() < MAX_BIKE_LENGTH {
|
||||||
|
let lane_len = map.get_l(pos.lane()).length();
|
||||||
|
if lane_len < MAX_BIKE_LENGTH {
|
||||||
|
// Just give up
|
||||||
|
return;
|
||||||
|
}
|
||||||
SidewalkSpot::bike_rack(Position::new(pos.lane(), MAX_BIKE_LENGTH), map)
|
SidewalkSpot::bike_rack(Position::new(pos.lane(), MAX_BIKE_LENGTH), map)
|
||||||
} else {
|
} else {
|
||||||
SidewalkSpot::bike_rack(pos, map)
|
SidewalkSpot::bike_rack(pos, map)
|
||||||
|
@ -442,6 +442,9 @@ impl WalkingSimState {
|
|||||||
}
|
}
|
||||||
Action::StartPreparingBike => {
|
Action::StartPreparingBike => {
|
||||||
let p = self.peds.get_mut(&id).unwrap();
|
let p = self.peds.get_mut(&id).unwrap();
|
||||||
|
// Since we enter this state when we're "close enough" to the goal, make sure
|
||||||
|
// we actually snap to this exact goal.
|
||||||
|
p.dist_along = p.goal.sidewalk_pos.dist_along();
|
||||||
p.moving = false;
|
p.moving = false;
|
||||||
p.bike_parking = Some(BikeParkingState {
|
p.bike_parking = Some(BikeParkingState {
|
||||||
is_parking: false,
|
is_parking: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user