2020-10-09 07:13:08 +03:00
|
|
|
//! Intermediate structures so that sim and game crates don't have a cyclic dependency.
|
2020-10-07 04:25:39 +03:00
|
|
|
|
2020-10-12 19:52:05 +03:00
|
|
|
use geom::{Angle, Distance, PolyLine, Pt2D};
|
|
|
|
use map_model::{BuildingID, ParkingLotID, Traversable, TurnID};
|
2018-11-13 22:34:17 +03:00
|
|
|
|
2020-10-20 21:38:38 +03:00
|
|
|
use crate::{AgentID, CarID, PedestrianID, PersonID};
|
2020-10-06 06:26:11 +03:00
|
|
|
|
2018-11-23 00:02:04 +03:00
|
|
|
#[derive(Clone)]
|
2018-11-13 22:34:17 +03:00
|
|
|
pub struct DrawPedestrianInput {
|
|
|
|
pub id: PedestrianID,
|
|
|
|
pub pos: Pt2D,
|
2019-05-06 22:12:31 +03:00
|
|
|
pub facing: Angle,
|
2018-11-13 22:34:17 +03:00
|
|
|
pub waiting_for_turn: Option<TurnID>,
|
2018-11-17 01:23:33 +03:00
|
|
|
pub preparing_bike: bool,
|
2020-01-13 20:21:22 +03:00
|
|
|
pub waiting_for_bus: bool,
|
2018-12-03 22:12:05 +03:00
|
|
|
pub on: Traversable,
|
2018-11-13 22:34:17 +03:00
|
|
|
}
|
|
|
|
|
2019-08-17 08:18:19 +03:00
|
|
|
pub struct DrawPedCrowdInput {
|
|
|
|
pub low: Distance,
|
|
|
|
pub high: Distance,
|
|
|
|
pub members: Vec<PedestrianID>,
|
2019-11-21 20:57:01 +03:00
|
|
|
pub location: PedCrowdLocation,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum PedCrowdLocation {
|
2020-10-09 07:13:08 +03:00
|
|
|
/// bool is contraflow
|
2019-11-21 20:57:01 +03:00
|
|
|
Sidewalk(Traversable, bool),
|
2020-07-31 22:49:33 +03:00
|
|
|
BldgDriveway(BuildingID),
|
|
|
|
LotDriveway(ParkingLotID),
|
2019-08-17 08:18:19 +03:00
|
|
|
}
|
|
|
|
|
2018-11-23 00:02:04 +03:00
|
|
|
#[derive(Clone)]
|
2018-11-13 22:34:17 +03:00
|
|
|
pub struct DrawCarInput {
|
|
|
|
pub id: CarID,
|
|
|
|
pub waiting_for_turn: Option<TurnID>,
|
2019-02-27 03:39:17 +03:00
|
|
|
pub status: CarStatus,
|
2020-10-08 00:16:58 +03:00
|
|
|
pub show_parking_intent: bool,
|
2020-10-09 07:13:08 +03:00
|
|
|
/// Front of the car
|
2018-12-03 22:12:05 +03:00
|
|
|
pub on: Traversable,
|
2020-10-09 07:13:08 +03:00
|
|
|
/// Possibly the rest
|
2020-07-15 20:04:47 +03:00
|
|
|
pub partly_on: Vec<Traversable>,
|
2019-08-13 22:20:28 +03:00
|
|
|
pub label: Option<String>,
|
2019-01-11 02:11:16 +03:00
|
|
|
|
2019-08-19 23:34:25 +03:00
|
|
|
// Starts at the BACK of the car.
|
2019-01-11 02:11:16 +03:00
|
|
|
pub body: PolyLine,
|
2018-11-13 22:34:17 +03:00
|
|
|
}
|
|
|
|
|
2019-02-07 06:33:51 +03:00
|
|
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
2019-02-27 03:39:17 +03:00
|
|
|
pub enum CarStatus {
|
2018-11-13 22:34:17 +03:00
|
|
|
Moving,
|
2019-10-20 01:24:40 +03:00
|
|
|
Parked,
|
2018-11-13 22:34:17 +03:00
|
|
|
}
|
|
|
|
|
2019-08-07 01:24:34 +03:00
|
|
|
pub struct UnzoomedAgent {
|
2020-10-20 21:38:38 +03:00
|
|
|
pub id: AgentID,
|
2019-08-07 01:24:34 +03:00
|
|
|
pub pos: Pt2D,
|
2020-10-09 07:13:08 +03:00
|
|
|
/// None means a bus.
|
2020-03-31 20:33:59 +03:00
|
|
|
pub person: Option<PersonID>,
|
2020-10-09 07:13:08 +03:00
|
|
|
/// True only for cars currently looking for parking. I don't want this struct to grow, but
|
|
|
|
/// this is important enough to call out here.
|
2020-07-14 19:33:10 +03:00
|
|
|
pub parking: bool,
|
2019-08-07 01:24:34 +03:00
|
|
|
}
|