mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-20 12:51:57 +03:00
dont allow 0s phases
This commit is contained in:
parent
4115d26b6b
commit
7b4c7306e7
@ -361,9 +361,14 @@ fn change_traffic_signal(signal: ControlTrafficSignal, ui: &mut UI, ctx: &mut Ev
|
||||
|
||||
fn change_phase_duration(current_duration: Duration) -> Box<dyn State> {
|
||||
WizardState::new(Box::new(move |wiz, ctx, _| {
|
||||
let new_duration = wiz.wrap(ctx).input_usize_prefilled(
|
||||
let new_duration = wiz.wrap(ctx).input_something(
|
||||
"How long should this phase be (seconds)?",
|
||||
format!("{}", current_duration.inner_seconds() as usize),
|
||||
Some(format!("{}", current_duration.inner_seconds() as usize)),
|
||||
Box::new(|line| {
|
||||
line.parse::<usize>()
|
||||
.ok()
|
||||
.and_then(|n| if n != 0 { Some(n) } else { None })
|
||||
}),
|
||||
)?;
|
||||
Some(Transition::PopWithData(Box::new(move |state, ui, ctx| {
|
||||
let mut editor = state.downcast_mut::<TrafficSignalEditor>().unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user