flag for num_agents in UI too

This commit is contained in:
Dustin Carlino 2019-03-09 12:20:00 -08:00
parent 5bba5ce31e
commit 1f16687c3e
2 changed files with 11 additions and 6 deletions

View File

@ -148,12 +148,13 @@ impl AmbientPluginWithPrimaryPlugins for SimControls {
// Interactively spawning stuff would ruin an A/B test, don't allow it
if ctx.primary.sim.is_empty() && ctx.input.action_chosen("seed the sim with agents")
{
Scenario::small_run(&ctx.primary.map).instantiate(
&mut ctx.primary.sim,
&ctx.primary.map,
&mut ctx.primary.current_flags.sim_flags.make_rng(),
&mut Timer::new("seed sim"),
);
Scenario::scaled_run(&ctx.primary.map, ctx.primary.current_flags.num_agents)
.instantiate(
&mut ctx.primary.sim,
&ctx.primary.map,
&mut ctx.primary.current_flags.sim_flags.make_rng(),
&mut Timer::new("seed sim"),
);
*ctx.recalculate_current_selection = true;
}

View File

@ -40,6 +40,10 @@ pub struct Flags {
/// Enable cpuprofiler?
#[structopt(long = "enable_profiler")]
pub enable_profiler: bool,
/// Number of agents to generate when small_spawn called
#[structopt(long = "num_agents", default_value = "100")]
pub num_agents: usize,
}
pub trait UIState {