mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
dont depend on sim in precompute crate
This commit is contained in:
parent
e2de3e208c
commit
a3b03952cf
@ -7,5 +7,5 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
abstutil = { path = "../abstutil" }
|
abstutil = { path = "../abstutil" }
|
||||||
log = "0.4.5"
|
log = "0.4.5"
|
||||||
sim = { path = "../sim" }
|
map_model = { path = "../map_model" }
|
||||||
structopt = "0.2"
|
structopt = "0.2"
|
||||||
|
@ -1,20 +1,43 @@
|
|||||||
use abstutil::{LogAdapter, Timer};
|
use abstutil::{LogAdapter, Timer};
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use sim::SimFlags;
|
use map_model::{Map, MapEdits};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
static LOG_ADAPTER: LogAdapter = LogAdapter;
|
static LOG_ADAPTER: LogAdapter = LogAdapter;
|
||||||
|
|
||||||
|
#[derive(StructOpt)]
|
||||||
|
#[structopt(name = "precompute")]
|
||||||
|
struct Flags {
|
||||||
|
/// Map
|
||||||
|
#[structopt(name = "load")]
|
||||||
|
load: String,
|
||||||
|
|
||||||
|
/// Name of map edits. Shouldn't be a full path or have the ".json"
|
||||||
|
#[structopt(long = "edits_name")]
|
||||||
|
edits_name: String,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log::set_max_level(LevelFilter::Debug);
|
log::set_max_level(LevelFilter::Debug);
|
||||||
log::set_logger(&LOG_ADAPTER).unwrap();
|
log::set_logger(&LOG_ADAPTER).unwrap();
|
||||||
|
|
||||||
let flags = SimFlags::from_args();
|
let flags = Flags::from_args();
|
||||||
let mut timer = Timer::new(&format!(
|
let mut timer = Timer::new(&format!(
|
||||||
"precompute {} with {}",
|
"precompute {} with {}",
|
||||||
flags.load, flags.edits_name
|
flags.load, flags.edits_name
|
||||||
));
|
));
|
||||||
let (map, _) = sim::load(flags, None, &mut timer);
|
|
||||||
|
let edits: MapEdits = if flags.edits_name == "no_edits" {
|
||||||
|
MapEdits::new(&flags.load)
|
||||||
|
} else {
|
||||||
|
abstutil::read_json(&format!(
|
||||||
|
"../data/edits/{}/{}.json",
|
||||||
|
flags.load, flags.edits_name
|
||||||
|
))
|
||||||
|
.unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
|
let map = Map::new(&flags.load, edits, &mut timer).unwrap();
|
||||||
timer.start("save map");
|
timer.start("save map");
|
||||||
map.save();
|
map.save();
|
||||||
timer.stop("save map");
|
timer.stop("save map");
|
||||||
|
Loading…
Reference in New Issue
Block a user