mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
better default for run name when there are scenarios
This commit is contained in:
parent
4f6cb2db60
commit
df88486b5e
@ -106,7 +106,7 @@ fn launch_test(test: &ABTest, ui: &mut UI, ctx: &mut EventCtx) -> Mode {
|
|||||||
sim_flags: SimFlags {
|
sim_flags: SimFlags {
|
||||||
load: load.clone(),
|
load: load.clone(),
|
||||||
rng_seed,
|
rng_seed,
|
||||||
run_name: format!("{} with {}", test.test_name, test.edits1_name),
|
run_name: Some(format!("{} with {}", test.test_name, test.edits1_name)),
|
||||||
edits_name: test.edits1_name.clone(),
|
edits_name: test.edits1_name.clone(),
|
||||||
},
|
},
|
||||||
..current_flags.clone()
|
..current_flags.clone()
|
||||||
@ -119,7 +119,7 @@ fn launch_test(test: &ABTest, ui: &mut UI, ctx: &mut EventCtx) -> Mode {
|
|||||||
sim_flags: SimFlags {
|
sim_flags: SimFlags {
|
||||||
load,
|
load,
|
||||||
rng_seed,
|
rng_seed,
|
||||||
run_name: format!("{} with {}", test.test_name, test.edits2_name),
|
run_name: Some(format!("{} with {}", test.test_name, test.edits2_name)),
|
||||||
edits_name: test.edits2_name.clone(),
|
edits_name: test.edits2_name.clone(),
|
||||||
},
|
},
|
||||||
..current_flags.clone()
|
..current_flags.clone()
|
||||||
|
@ -440,7 +440,11 @@ impl PerMapUI {
|
|||||||
// TODO savestate_every gets lost
|
// TODO savestate_every gets lost
|
||||||
self.sim = Sim::new(
|
self.sim = Sim::new(
|
||||||
&self.map,
|
&self.map,
|
||||||
self.current_flags.sim_flags.run_name.clone(),
|
self.current_flags
|
||||||
|
.sim_flags
|
||||||
|
.run_name
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "unnamed".to_string()),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ pub struct SimFlags {
|
|||||||
pub rng_seed: Option<u8>,
|
pub rng_seed: Option<u8>,
|
||||||
|
|
||||||
/// Run name for savestating
|
/// Run name for savestating
|
||||||
#[structopt(long = "run_name", default_value = "unnamed")]
|
#[structopt(long = "run_name")]
|
||||||
pub run_name: String,
|
pub run_name: Option<String>,
|
||||||
|
|
||||||
/// Name of map edits. Shouldn't be a full path or have the ".json"
|
/// Name of map edits. Shouldn't be a full path or have the ".json"
|
||||||
#[structopt(long = "edits_name", default_value = "no_edits")]
|
#[structopt(long = "edits_name", default_value = "no_edits")]
|
||||||
@ -42,7 +42,7 @@ impl SimFlags {
|
|||||||
SimFlags {
|
SimFlags {
|
||||||
load: PathBuf::from(format!("../data/maps/{}.abst", map)),
|
load: PathBuf::from(format!("../data/maps/{}.abst", map)),
|
||||||
rng_seed: Some(42),
|
rng_seed: Some(42),
|
||||||
run_name: run_name.to_string(),
|
run_name: Some(run_name.to_string()),
|
||||||
edits_name: "no_edits".to_string(),
|
edits_name: "no_edits".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,8 +94,9 @@ impl SimFlags {
|
|||||||
|
|
||||||
let mut sim = Sim::new(
|
let mut sim = Sim::new(
|
||||||
&map,
|
&map,
|
||||||
// TODO or the scenario name if no run name
|
self.run_name
|
||||||
self.run_name.clone(),
|
.clone()
|
||||||
|
.unwrap_or_else(|| scenario.scenario_name.clone()),
|
||||||
savestate_every,
|
savestate_every,
|
||||||
);
|
);
|
||||||
scenario.instantiate(&mut sim, &map, &mut rng, timer);
|
scenario.instantiate(&mut sim, &map, &mut rng, timer);
|
||||||
@ -109,7 +110,13 @@ impl SimFlags {
|
|||||||
apply_edits(&mut map, &self.edits_name, timer);
|
apply_edits(&mut map, &self.edits_name, timer);
|
||||||
|
|
||||||
timer.start("create sim");
|
timer.start("create sim");
|
||||||
let sim = Sim::new(&map, self.run_name.clone(), savestate_every);
|
let sim = Sim::new(
|
||||||
|
&map,
|
||||||
|
self.run_name
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "unnamed".to_string()),
|
||||||
|
savestate_every,
|
||||||
|
);
|
||||||
timer.stop("create sim");
|
timer.stop("create sim");
|
||||||
|
|
||||||
(map, sim, rng)
|
(map, sim, rng)
|
||||||
@ -121,7 +128,13 @@ impl SimFlags {
|
|||||||
apply_edits(&mut map, &self.edits_name, timer);
|
apply_edits(&mut map, &self.edits_name, timer);
|
||||||
|
|
||||||
timer.start("create sim");
|
timer.start("create sim");
|
||||||
let sim = Sim::new(&map, self.run_name.clone(), savestate_every);
|
let sim = Sim::new(
|
||||||
|
&map,
|
||||||
|
self.run_name
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "unnamed".to_string()),
|
||||||
|
savestate_every,
|
||||||
|
);
|
||||||
timer.stop("create sim");
|
timer.stop("create sim");
|
||||||
|
|
||||||
(map, sim, rng)
|
(map, sim, rng)
|
||||||
|
Loading…
Reference in New Issue
Block a user