timewarp restores last picked halt_limit (#305)

This commit is contained in:
Michael Kirk 2020-08-28 17:20:50 -07:00 committed by GitHub
parent a36ef99c06
commit f58b60d7f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -22,6 +22,7 @@ pub struct Options {
pub time_increment: Duration,
pub resume_after_edit: bool,
pub dont_draw_time_warp: bool,
pub time_warp_halt_limit: Duration,
pub language: Option<String>,
}
@ -41,6 +42,7 @@ impl Options {
time_increment: Duration::minutes(10),
resume_after_edit: true,
dont_draw_time_warp: false,
time_warp_halt_limit: Duration::minutes(5),
language: None,
}

View File

@ -359,7 +359,7 @@ impl JumpToTime {
fn new(ctx: &mut EventCtx, app: &App, maybe_mode: Option<GameplayMode>) -> JumpToTime {
let target = app.primary.sim.time();
let end_of_day = app.primary.sim.get_end_of_day();
let halt_limit = Duration::minutes(5);
let halt_limit = app.opts.time_warp_halt_limit;
JumpToTime {
target,
halt_limit,
@ -444,11 +444,13 @@ impl State for JumpToTime {
}
"choose delay" => return Transition::Keep,
"jump to delay" => {
let halt_limit = self.panel.persistent_split_value("choose delay");
app.opts.time_warp_halt_limit = halt_limit;
return Transition::Replace(TimeWarpScreen::new(
ctx,
app,
app.primary.sim.get_end_of_day(),
Some(self.panel.persistent_split_value("choose delay")),
Some(halt_limit),
));
}
_ => unreachable!(),