mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 23:43:25 +03:00
recording and communicating delayed starts
This commit is contained in:
parent
cb053baf49
commit
c4c61cf7d9
@ -196,6 +196,7 @@ c8433d44c82e2471ee777c90d4bcd449 data/system/assets/timeline/goal_pos.svg
|
||||
4527c9b19de34133f1db07577284e7cf data/system/assets/timeline/biking.svg
|
||||
28f143690de67bbda88e141228393c1c data/system/assets/timeline/parking.svg
|
||||
8bf3eba8ea9d96e00395ad117385d0e5 data/system/assets/timeline/waiting_for_bus.svg
|
||||
6c85abc97c8faf30defe1cfb53af4fe8 data/system/assets/timeline/delayed_start.svg
|
||||
cb589c4b42bb9f3bdaabbf485897ab51 data/system/assets/timeline/current_pos.svg
|
||||
10b02a86fe4b695ee5bfcde982a41c10 data/system/assets/timeline/walking.svg
|
||||
680d81bc03b0115abcc85a28885ae94b data/system/assets/timeline/driving.svg
|
||||
@ -227,16 +228,15 @@ e27d41c916a721b330459ce85a114dbc data/system/maps/23rd.bin
|
||||
cc45f42cb24cad1cfdbf5ed7a0cb86d4 data/system/synthetic_maps/signal_double.json
|
||||
8b949cc34d9a27ace0bd8ecde55a9520 data/system/synthetic_maps/signal_single.json
|
||||
1cd7be125e1d992613ed3a41e8b25b6a data/system/synthetic_maps/signal_fan_in.json
|
||||
e6e6a0d69e999d13914d038182a610df data/system/scenarios/ballard/weekday.bin
|
||||
90a2f56be7381f7cb7d6fe581ccbd71c data/system/scenarios/intl_district/weekday.bin
|
||||
06e5969553aac31397fb82a46d965218 data/system/scenarios/23rd/weekday.bin
|
||||
55e34b7ad84ba414d7a727105b2a4214 data/system/scenarios/lakeslice/weekday.bin
|
||||
c13a214eeac17fe005531e9d2b820371 data/system/scenarios/downtown/weekday.bin
|
||||
23484818ce17120fd059fc8e12590487 data/system/scenarios/huge_seattle/weekday.bin
|
||||
ce9000d9f0fb5e80f87580808641f5e0 data/system/scenarios/caphill/weekday.bin
|
||||
06552edb374a27ac8cbf84e0bde83cac data/system/scenarios/montlake/weekday.bin
|
||||
3395f869c843e975a865ec6abdfd73a6 data/system/scenarios/ballard/weekday.bin
|
||||
5808fa3463d40ebdc11df740af957e27 data/system/scenarios/intl_district/weekday.bin
|
||||
ba178b246461b66a0b888fae82392be6 data/system/scenarios/23rd/weekday.bin
|
||||
8dae2cd0dd23a72d9b225a218b203c13 data/system/scenarios/lakeslice/weekday.bin
|
||||
e26238b69d0ce1c00948221d9a089445 data/system/scenarios/downtown/weekday.bin
|
||||
7fa74272f3b443f985c8e2c9f2eb6175 data/system/scenarios/huge_seattle/weekday.bin
|
||||
dfe4f16099b828e06cedea0eaa1531d9 data/system/scenarios/caphill/weekday.bin
|
||||
f180a68083c44e0e21b65e3e63be8068 data/system/scenarios/montlake/weekday.bin
|
||||
ae0946df6ab1edf0ca3b6959093e27d3 data/system/prebaked_results/signal_single/tutorial lvl1.bin
|
||||
1d0772af01ceea5d1f28e586b227597e data/system/prebaked_results/signal_single/tutorial lvl2.bin
|
||||
fcc727e48613c12ab336847b81a43bf4 data/system/prebaked_results/montlake/car vs bike contention.bin
|
||||
a8ae974a16816f4a74b7d87d155fee83 data/system/prebaked_results/montlake/weekday.bin
|
||||
560083ca84a7367a4bc11a320655206b data/system/prebaked_results/montlake/car vs bus contention.bin
|
||||
|
3
data/system/assets/timeline/delayed_start.svg
Normal file
3
data/system/assets/timeline/delayed_start.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 5.71986L17.4 1.85986L16.11 3.38986L20.71 7.24986L22 5.71986ZM7.88 3.38986L6.6 1.85986L2 5.70986L3.29 7.23986L7.88 3.38986ZM12.5 7.99986H11V13.9999L15.75 16.8499L16.5 15.6199L12.5 13.2499V7.99986ZM12 3.99986C7.03 3.99986 3 8.02986 3 12.9999C3 17.9699 7.02 21.9999 12 21.9999C16.97 21.9999 21 17.9699 21 12.9999C21 8.02986 16.97 3.99986 12 3.99986ZM12 19.9999C8.13 19.9999 5 16.8699 5 12.9999C5 9.12986 8.13 5.99986 12 5.99986C15.87 5.99986 19 9.12986 19 12.9999C19 16.8699 15.87 19.9999 12 19.9999Z" fill="yellow"/>
|
||||
</svg>
|
After Width: | Height: | Size: 631 B |
@ -41,14 +41,24 @@ pub fn trips(
|
||||
wheres_waldo = false;
|
||||
rows.push(current_status(ctx, person, map));
|
||||
}
|
||||
|
||||
(
|
||||
"future",
|
||||
Color::hex("#4CA7E9"),
|
||||
open_trips
|
||||
.get(t)
|
||||
.map(|_| trip::future(ctx, app, *t, details)),
|
||||
)
|
||||
let start_time = sim.trip_info(*t).0;
|
||||
if sim.time() > start_time {
|
||||
(
|
||||
"delayed start",
|
||||
Color::YELLOW,
|
||||
open_trips
|
||||
.get(t)
|
||||
.map(|_| trip::future(ctx, app, *t, details)),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
"future",
|
||||
Color::hex("#4CA7E9"),
|
||||
open_trips
|
||||
.get(t)
|
||||
.map(|_| trip::future(ctx, app, *t, details)),
|
||||
)
|
||||
}
|
||||
}
|
||||
TripResult::Ok(a) => {
|
||||
assert!(wheres_waldo);
|
||||
|
@ -111,6 +111,14 @@ pub fn future(ctx: &mut EventCtx, app: &App, trip: TripID, details: &mut Details
|
||||
|
||||
let mut col = Vec::new();
|
||||
|
||||
let now = app.primary.sim.time();
|
||||
if now > start_time {
|
||||
col.extend(make_table(
|
||||
ctx,
|
||||
vec![("Start delayed", (now - start_time).to_string())],
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(estimated_trip_time) = app
|
||||
.has_prebaked()
|
||||
.and_then(|_| app.prebaked().finished_trip_time(trip))
|
||||
@ -341,6 +349,7 @@ fn make_timeline(
|
||||
TripPhaseType::WaitingForBus(_, _) => app.cs.bus_stop,
|
||||
TripPhaseType::RidingBus(_, _, _) => app.cs.bus_lane,
|
||||
TripPhaseType::Aborted | TripPhaseType::Finished => unreachable!(),
|
||||
TripPhaseType::DelayedStart => Color::YELLOW,
|
||||
}
|
||||
.alpha(0.7);
|
||||
|
||||
@ -402,6 +411,7 @@ fn make_timeline(
|
||||
"../data/system/assets/timeline/riding_bus.svg"
|
||||
}
|
||||
TripPhaseType::Aborted | TripPhaseType::Finished => unreachable!(),
|
||||
TripPhaseType::DelayedStart => "../data/system/assets/timeline/delayed_start.svg",
|
||||
},
|
||||
// TODO Hardcoded layouting...
|
||||
Pt2D::new(0.5 * phase_width, -20.0),
|
||||
|
@ -61,6 +61,7 @@ pub enum TripPhaseType {
|
||||
RidingBus(BusRouteID, BusStopID, CarID),
|
||||
Aborted,
|
||||
Finished,
|
||||
DelayedStart,
|
||||
}
|
||||
|
||||
impl TripPhaseType {
|
||||
@ -74,6 +75,7 @@ impl TripPhaseType {
|
||||
TripPhaseType::RidingBus(r, _, _) => format!("riding bus {}", map.get_br(r).name),
|
||||
TripPhaseType::Aborted => "trip aborted due to some bug".to_string(),
|
||||
TripPhaseType::Finished => "trip finished".to_string(),
|
||||
TripPhaseType::DelayedStart => "delayed by previous trip taking too long".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -826,6 +826,13 @@ impl TripManager {
|
||||
person
|
||||
.delayed_trips
|
||||
.push((trip, spec, maybe_req, maybe_path));
|
||||
self.events.push(Event::TripPhaseStarting(
|
||||
trip,
|
||||
person.id,
|
||||
self.trips[trip.0].mode,
|
||||
None,
|
||||
TripPhaseType::DelayedStart,
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user