diff --git a/game/src/app.rs b/game/src/app.rs index 356cec58e3..e06a2206c3 100644 --- a/game/src/app.rs +++ b/game/src/app.rs @@ -43,6 +43,7 @@ impl App { ctx.set_style(cs.gui_style.clone()); let primary = ctx.loading_screen("load map", |ctx, mut timer| { + assert!(flags.sim_flags.modifiers.is_empty()); let (map, sim, _) = flags.sim_flags.load(timer); PerMap::map_loaded(map, sim, splash, flags, &opts, &cs, ctx, &mut timer) }); diff --git a/game/src/lib.rs b/game/src/lib.rs index 4dce94d393..c707e84eef 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -3,7 +3,7 @@ extern crate log; use abstutil::{CmdArgs, Timer}; use geom::Duration; -use sim::{ScenarioModifier, SimFlags}; +use sim::SimFlags; use crate::app::Flags; @@ -104,6 +104,11 @@ pub fn main() { sandbox::TutorialPointer::new(n - 1, 0), )); } + + // Don't keep the scenario modifiers in the original sim_flags; they shouldn't apply to + // other scenarios loaed in the UI later. + let modifiers = flags.sim_flags.modifiers.drain(..).collect(); + if mode.is_none() && flags.sim_flags.load.contains("scenarios/") { // TODO regex let parts = flags.sim_flags.load.split("/").collect::>(); @@ -111,12 +116,6 @@ pub fn main() { let scenario = abstutil::basename(parts[parts.len() - 1]); flags.sim_flags.load = abstutil::path_map(&map_name); - let modifiers: Vec = args - .optional_parse("--scenario_modifiers", |s| { - abstutil::from_json(&s.to_string().into_bytes()) - }) - .unwrap_or_else(Vec::new); - mode = Some(sandbox::GameplayMode::PlayScenario( map_name, scenario, modifiers, )); diff --git a/sim/src/make/load.rs b/sim/src/make/load.rs index aecabc71e7..0903a002e3 100644 --- a/sim/src/make/load.rs +++ b/sim/src/make/load.rs @@ -26,11 +26,16 @@ impl SimFlags { let rng_seed = args .optional_parse("--rng_seed", |s| s.parse()) .unwrap_or(SimFlags::RNG_SEED); + let modifiers: Vec = args + .optional_parse("--scenario_modifiers", |s| { + abstutil::from_json(&s.to_string().into_bytes()) + }) + .unwrap_or_else(Vec::new); SimFlags { load: args .optional_free() .unwrap_or_else(|| abstutil::path_map("montlake")), - modifiers: Vec::new(), + modifiers, rng_seed, opts: SimOptions::from_args(args, rng_seed), }