mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 22:13:27 +03:00
Let Santa start locally even if the Queen Anne map is missing. (Which it
is by default in the .zip release!) This also inches towards #959 a bit
This commit is contained in:
parent
cff5bc5978
commit
91b269435e
@ -29,9 +29,14 @@ fn run(mut settings: Settings) {
|
||||
.update_widgetry_settings(settings)
|
||||
.canvas_settings(options.canvas_settings.clone());
|
||||
widgetry::run(settings, |ctx| {
|
||||
map_gui::SimpleApp::new(ctx, options, args.map_name(), args.cam, (), |ctx, app| {
|
||||
vec![viewer::Viewer::random_start(ctx, app)]
|
||||
})
|
||||
map_gui::SimpleApp::new(
|
||||
ctx,
|
||||
options,
|
||||
Some(args.map_name()),
|
||||
args.cam,
|
||||
(),
|
||||
|ctx, app| vec![viewer::Viewer::random_start(ctx, app)],
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,14 @@ pub fn run(mut settings: Settings) {
|
||||
.update_widgetry_settings(settings)
|
||||
.canvas_settings(opts.canvas_settings.clone());
|
||||
widgetry::run(settings, |ctx| {
|
||||
map_gui::SimpleApp::new(ctx, opts, args.map_name(), args.cam, (), |ctx, app| {
|
||||
vec![viewer::Viewer::new_state(ctx, app)]
|
||||
})
|
||||
map_gui::SimpleApp::new(
|
||||
ctx,
|
||||
opts,
|
||||
Some(args.map_name()),
|
||||
args.cam,
|
||||
(),
|
||||
|ctx, app| vec![viewer::Viewer::new_state(ctx, app)],
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,13 @@ fn main() {
|
||||
.update_widgetry_settings(widgetry::Settings::new("OSM parking mapper"))
|
||||
.canvas_settings(options.canvas_settings.clone());
|
||||
widgetry::run(settings, |ctx| {
|
||||
map_gui::SimpleApp::new(ctx, options, args.map_name(), args.cam, (), |ctx, app| {
|
||||
vec![mapper::ParkingMapper::new_state(ctx, app)]
|
||||
})
|
||||
map_gui::SimpleApp::new(
|
||||
ctx,
|
||||
options,
|
||||
Some(args.map_name()),
|
||||
args.cam,
|
||||
(),
|
||||
|ctx, app| vec![mapper::ParkingMapper::new_state(ctx, app)],
|
||||
)
|
||||
});
|
||||
}
|
||||
|
@ -40,23 +40,24 @@ fn run(mut settings: Settings) {
|
||||
let session = session::Session::load();
|
||||
session.save();
|
||||
|
||||
map_gui::SimpleApp::new(
|
||||
ctx,
|
||||
opts,
|
||||
abstio::MapName::seattle("qa"),
|
||||
None,
|
||||
session,
|
||||
|ctx, app| {
|
||||
if app.opts.dev {
|
||||
app.session.unlock_all();
|
||||
}
|
||||
app.session.music =
|
||||
music::Music::start(ctx, app.session.play_music, "jingle_bells");
|
||||
app.session.music.specify_volume(music::OUT_OF_GAME);
|
||||
// On native, we may not have this file. Start with a blank map if so. When we try to pick
|
||||
// a level on the title screen, we'll download it if needed.
|
||||
let mut start_map = Some(abstio::MapName::seattle("qa"));
|
||||
if cfg!(not(target_arch = "wasm32"))
|
||||
&& !abstio::file_exists(start_map.as_ref().unwrap().path())
|
||||
{
|
||||
start_map = None;
|
||||
}
|
||||
|
||||
vec![title::TitleScreen::new_state(ctx, app)]
|
||||
},
|
||||
)
|
||||
map_gui::SimpleApp::new(ctx, opts, start_map, None, session, |ctx, app| {
|
||||
if app.opts.dev {
|
||||
app.session.unlock_all();
|
||||
}
|
||||
app.session.music = music::Music::start(ctx, app.session.play_music, "jingle_bells");
|
||||
app.session.music.specify_volume(music::OUT_OF_GAME);
|
||||
|
||||
vec![title::TitleScreen::new_state(ctx, app)]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl<T: 'static> SimpleApp<T> {
|
||||
>(
|
||||
ctx: &mut EventCtx,
|
||||
opts: Options,
|
||||
map_name: MapName,
|
||||
map_name: Option<MapName>,
|
||||
cam: Option<String>,
|
||||
session: T,
|
||||
init_states: F,
|
||||
@ -110,10 +110,10 @@ impl<T: 'static> SimpleApp<T> {
|
||||
ctx.canvas.settings = opts.canvas_settings.clone();
|
||||
|
||||
let cs = ColorScheme::new(ctx, opts.color_scheme);
|
||||
// Start with a blank map
|
||||
let map = Map::blank();
|
||||
// Start with a minimal map
|
||||
let map = Map::almost_blank();
|
||||
let draw_map = DrawMap::new(ctx, &map, &opts, &cs, &mut Timer::throwaway());
|
||||
let app = SimpleApp {
|
||||
let mut app = SimpleApp {
|
||||
map,
|
||||
draw_map,
|
||||
cs,
|
||||
@ -123,15 +123,19 @@ impl<T: 'static> SimpleApp<T> {
|
||||
time: Time::START_OF_DAY,
|
||||
};
|
||||
|
||||
let states = vec![MapLoader::new_state(
|
||||
ctx,
|
||||
&app,
|
||||
map_name,
|
||||
Box::new(move |ctx, app| {
|
||||
URLManager::change_camera(ctx, cam.as_ref(), app.map().get_gps_bounds());
|
||||
Transition::Clear(init_states(ctx, app))
|
||||
}),
|
||||
)];
|
||||
let states = if let Some(map_name) = map_name {
|
||||
vec![MapLoader::new_state(
|
||||
ctx,
|
||||
&app,
|
||||
map_name,
|
||||
Box::new(move |ctx, app| {
|
||||
URLManager::change_camera(ctx, cam.as_ref(), app.map().get_gps_bounds());
|
||||
Transition::Clear(init_states(ctx, app))
|
||||
}),
|
||||
)]
|
||||
} else {
|
||||
init_states(ctx, &mut app)
|
||||
};
|
||||
(app, states)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user