mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
remove repeated choice from "speed". use nicer method
This commit is contained in:
parent
8722c102b9
commit
e8e678f4ca
@ -737,7 +737,7 @@ pub fn speed_limit_choices(app: &App, preset: Option<Speed>) -> Vec<Choice<Speed
|
||||
.map(|mph| Speed::miles_per_hour(mph as f64))
|
||||
.collect::<Vec<_>>();
|
||||
if let Some(preset) = preset {
|
||||
if !speeds.iter().all(|x| *x == preset) {
|
||||
if !speeds.contains(&preset) {
|
||||
speeds.push(preset);
|
||||
speeds.sort();
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ fn width_choices(app: &App, l: LaneID) -> Vec<Choice<Distance>> {
|
||||
Distance::meters(3.0),
|
||||
];
|
||||
let current_width = app.primary.map.get_l(l).width;
|
||||
if choices.iter().all(|x| *x != current_width) {
|
||||
if !choices.contains(¤t_width) {
|
||||
choices.push(current_width);
|
||||
choices.sort();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user