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

View File

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