mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
fix bugs with follow plugin at the end of the trip
This commit is contained in:
parent
ce9b9da5bb
commit
9883da6fa8
@ -32,12 +32,12 @@ impl Plugin for FollowState {
|
|||||||
.get_canonical_point_for_trip(*trip, &ctx.primary.map)
|
.get_canonical_point_for_trip(*trip, &ctx.primary.map)
|
||||||
{
|
{
|
||||||
ctx.canvas.center_on_map_pt(pt);
|
ctx.canvas.center_on_map_pt(pt);
|
||||||
quit = ctx.input.key_pressed(Key::Return, "stop following");
|
|
||||||
} else {
|
} else {
|
||||||
// TODO ideally they wouldnt vanish for so long according to
|
// TODO ideally they wouldnt vanish for so long according to
|
||||||
// get_canonical_point_for_trip
|
// get_canonical_point_for_trip
|
||||||
warn!("{} is gone... temporarily or not?", trip);
|
warn!("{} is gone... temporarily or not?", trip);
|
||||||
}
|
}
|
||||||
|
quit = ctx.input.key_pressed(Key::Return, "stop following");
|
||||||
};
|
};
|
||||||
if quit {
|
if quit {
|
||||||
*self = FollowState::Empty;
|
*self = FollowState::Empty;
|
||||||
|
@ -228,7 +228,7 @@ impl TripManager {
|
|||||||
|
|
||||||
pub fn trip_to_agent(&self, id: TripID) -> Option<AgentID> {
|
pub fn trip_to_agent(&self, id: TripID) -> Option<AgentID> {
|
||||||
let trip = self.trips.get(id.0)?;
|
let trip = self.trips.get(id.0)?;
|
||||||
match trip.legs[0] {
|
match trip.legs.get(0)? {
|
||||||
TripLeg::Walk(_) => Some(AgentID::Pedestrian(trip.ped)),
|
TripLeg::Walk(_) => Some(AgentID::Pedestrian(trip.ped)),
|
||||||
TripLeg::Drive(ref parked, _) => Some(AgentID::Car(parked.car)),
|
TripLeg::Drive(ref parked, _) => Some(AgentID::Car(parked.car)),
|
||||||
// TODO Should be the bus, but apparently transit sim tracks differently?
|
// TODO Should be the bus, but apparently transit sim tracks differently?
|
||||||
|
Loading…
Reference in New Issue
Block a user