mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
render buildings earlier so paths dont overlap sidewalks
This commit is contained in:
parent
c7bf59dde0
commit
a91359a66f
@ -46,6 +46,7 @@ impl SimController {
|
||||
}
|
||||
if input.unimportant_key_pressed(Key::P, "load sim state") {
|
||||
self.sim = abstutil::read_json("sim_state").expect("sim state failed");
|
||||
println!("Loaded sim_state");
|
||||
}
|
||||
if self.last_step.is_some() {
|
||||
if input.unimportant_key_pressed(Key::Space, "pause sim") {
|
||||
|
@ -59,21 +59,25 @@ fn warp(line: String, map: &Map, canvas: &mut Canvas, selection_state: &mut Sele
|
||||
Ok(idx) => match line.chars().next().unwrap() {
|
||||
'l' => {
|
||||
let id = LaneID(idx);
|
||||
println!("Warping to {}", id);
|
||||
*selection_state = SelectionState::SelectedLane(id, None);
|
||||
map.get_l(id).first_pt()
|
||||
}
|
||||
'i' => {
|
||||
let id = IntersectionID(idx);
|
||||
println!("Warping to {}", id);
|
||||
*selection_state = SelectionState::SelectedIntersection(id);
|
||||
map.get_i(id).point
|
||||
}
|
||||
'b' => {
|
||||
let id = BuildingID(idx);
|
||||
println!("Warping to {}", id);
|
||||
*selection_state = SelectionState::SelectedBuilding(id);
|
||||
geometry::center(&map.get_b(id).points)
|
||||
}
|
||||
'p' => {
|
||||
let id = ParcelID(idx);
|
||||
println!("Warping to {}", id);
|
||||
geometry::center(&map.get_p(id).points)
|
||||
}
|
||||
_ => {
|
||||
|
@ -558,15 +558,7 @@ impl gui::GUI for UI {
|
||||
}
|
||||
}
|
||||
|
||||
for l in &lanes_onscreen {
|
||||
for c in &self.sim_ctrl.sim.get_draw_cars_on_lane(l.id, &self.map) {
|
||||
c.draw(g, self.color_car(c.id));
|
||||
}
|
||||
for p in &self.sim_ctrl.sim.get_draw_peds_on_lane(l.id, &self.map) {
|
||||
p.draw(g, self.color_ped(p.id));
|
||||
}
|
||||
}
|
||||
|
||||
// Building paths overlap sidewalks, so do these first to not look messy
|
||||
if self.show_buildings.is_enabled() {
|
||||
for b in &self.draw_map
|
||||
.get_buildings_onscreen(screen_bbox, &self.hider)
|
||||
@ -579,6 +571,15 @@ impl gui::GUI for UI {
|
||||
}
|
||||
}
|
||||
|
||||
for l in &lanes_onscreen {
|
||||
for c in &self.sim_ctrl.sim.get_draw_cars_on_lane(l.id, &self.map) {
|
||||
c.draw(g, self.color_car(c.id));
|
||||
}
|
||||
for p in &self.sim_ctrl.sim.get_draw_peds_on_lane(l.id, &self.map) {
|
||||
p.draw(g, self.color_ped(p.id));
|
||||
}
|
||||
}
|
||||
|
||||
self.current_selection_state.draw(
|
||||
&self.map,
|
||||
&self.canvas,
|
||||
|
Loading…
Reference in New Issue
Block a user