mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
speed up some stuff indirectly used in bus locations to not be so terrible
This commit is contained in:
parent
6989c72aa1
commit
a4b24c2643
@ -771,6 +771,20 @@ impl DrivingSimState {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is about as expensive as get_draw_cars_on.
|
||||||
|
pub fn get_single_draw_car(
|
||||||
|
&self,
|
||||||
|
id: CarID,
|
||||||
|
now: Duration,
|
||||||
|
map: &Map,
|
||||||
|
transit: &TransitSimState,
|
||||||
|
) -> Option<DrawCarInput> {
|
||||||
|
let car = self.cars.get(&id)?;
|
||||||
|
self.get_draw_cars_on(now, car.router.head(), map, transit)
|
||||||
|
.into_iter()
|
||||||
|
.find(|d| d.id == id)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_draw_cars_on(
|
pub fn get_draw_cars_on(
|
||||||
&self,
|
&self,
|
||||||
now: Duration,
|
now: Duration,
|
||||||
|
@ -85,6 +85,15 @@ impl WalkingSimState {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_draw_ped(
|
||||||
|
&self,
|
||||||
|
id: PedestrianID,
|
||||||
|
now: Duration,
|
||||||
|
map: &Map,
|
||||||
|
) -> Option<DrawPedestrianInput> {
|
||||||
|
self.peds.get(&id).map(|p| p.get_draw_ped(now, map))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_all_draw_peds(&self, now: Duration, map: &Map) -> Vec<DrawPedestrianInput> {
|
pub fn get_all_draw_peds(&self, now: Duration, map: &Map) -> Vec<DrawPedestrianInput> {
|
||||||
self.peds
|
self.peds
|
||||||
.values()
|
.values()
|
||||||
|
@ -288,13 +288,14 @@ impl GetDrawAgents for Sim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_draw_car(&self, id: CarID, map: &Map) -> Option<DrawCarInput> {
|
fn get_draw_car(&self, id: CarID, map: &Map) -> Option<DrawCarInput> {
|
||||||
// TODO Faster
|
self.parking.get_draw_car(id, map, &self.trips).or_else(|| {
|
||||||
self.get_all_draw_cars(map).into_iter().find(|d| d.id == id)
|
self.driving
|
||||||
|
.get_single_draw_car(id, self.time, map, &self.transit)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_draw_ped(&self, id: PedestrianID, map: &Map) -> Option<DrawPedestrianInput> {
|
fn get_draw_ped(&self, id: PedestrianID, map: &Map) -> Option<DrawPedestrianInput> {
|
||||||
// TODO Faster
|
self.walking.get_draw_ped(id, self.time, map)
|
||||||
self.get_all_draw_peds(map).into_iter().find(|d| d.id == id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_draw_cars(&self, on: Traversable, map: &Map) -> Vec<DrawCarInput> {
|
fn get_draw_cars(&self, on: Traversable, map: &Map) -> Vec<DrawCarInput> {
|
||||||
|
Loading…
Reference in New Issue
Block a user