fix bugs with follow plugin at the end of the trip

This commit is contained in:
Dustin Carlino 2018-10-22 16:32:23 -07:00
parent ce9b9da5bb
commit 9883da6fa8
2 changed files with 2 additions and 2 deletions

View File

@ -32,12 +32,12 @@ impl Plugin for FollowState {
.get_canonical_point_for_trip(*trip, &ctx.primary.map)
{
ctx.canvas.center_on_map_pt(pt);
quit = ctx.input.key_pressed(Key::Return, "stop following");
} else {
// TODO ideally they wouldnt vanish for so long according to
// get_canonical_point_for_trip
warn!("{} is gone... temporarily or not?", trip);
}
quit = ctx.input.key_pressed(Key::Return, "stop following");
};
if quit {
*self = FollowState::Empty;

View File

@ -228,7 +228,7 @@ impl TripManager {
pub fn trip_to_agent(&self, id: TripID) -> Option<AgentID> {
let trip = self.trips.get(id.0)?;
match trip.legs[0] {
match trip.legs.get(0)? {
TripLeg::Walk(_) => Some(AgentID::Pedestrian(trip.ped)),
TripLeg::Drive(ref parked, _) => Some(AgentID::Car(parked.car)),
// TODO Should be the bus, but apparently transit sim tracks differently?