mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-29 12:43:38 +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)
|
.update_widgetry_settings(settings)
|
||||||
.canvas_settings(options.canvas_settings.clone());
|
.canvas_settings(options.canvas_settings.clone());
|
||||||
widgetry::run(settings, |ctx| {
|
widgetry::run(settings, |ctx| {
|
||||||
map_gui::SimpleApp::new(ctx, options, args.map_name(), args.cam, (), |ctx, app| {
|
map_gui::SimpleApp::new(
|
||||||
vec![viewer::Viewer::random_start(ctx, app)]
|
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)
|
.update_widgetry_settings(settings)
|
||||||
.canvas_settings(opts.canvas_settings.clone());
|
.canvas_settings(opts.canvas_settings.clone());
|
||||||
widgetry::run(settings, |ctx| {
|
widgetry::run(settings, |ctx| {
|
||||||
map_gui::SimpleApp::new(ctx, opts, args.map_name(), args.cam, (), |ctx, app| {
|
map_gui::SimpleApp::new(
|
||||||
vec![viewer::Viewer::new_state(ctx, app)]
|
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"))
|
.update_widgetry_settings(widgetry::Settings::new("OSM parking mapper"))
|
||||||
.canvas_settings(options.canvas_settings.clone());
|
.canvas_settings(options.canvas_settings.clone());
|
||||||
widgetry::run(settings, |ctx| {
|
widgetry::run(settings, |ctx| {
|
||||||
map_gui::SimpleApp::new(ctx, options, args.map_name(), args.cam, (), |ctx, app| {
|
map_gui::SimpleApp::new(
|
||||||
vec![mapper::ParkingMapper::new_state(ctx, app)]
|
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();
|
let session = session::Session::load();
|
||||||
session.save();
|
session.save();
|
||||||
|
|
||||||
map_gui::SimpleApp::new(
|
// On native, we may not have this file. Start with a blank map if so. When we try to pick
|
||||||
ctx,
|
// a level on the title screen, we'll download it if needed.
|
||||||
opts,
|
let mut start_map = Some(abstio::MapName::seattle("qa"));
|
||||||
abstio::MapName::seattle("qa"),
|
if cfg!(not(target_arch = "wasm32"))
|
||||||
None,
|
&& !abstio::file_exists(start_map.as_ref().unwrap().path())
|
||||||
session,
|
{
|
||||||
|ctx, app| {
|
start_map = None;
|
||||||
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)]
|
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,
|
ctx: &mut EventCtx,
|
||||||
opts: Options,
|
opts: Options,
|
||||||
map_name: MapName,
|
map_name: Option<MapName>,
|
||||||
cam: Option<String>,
|
cam: Option<String>,
|
||||||
session: T,
|
session: T,
|
||||||
init_states: F,
|
init_states: F,
|
||||||
@ -110,10 +110,10 @@ impl<T: 'static> SimpleApp<T> {
|
|||||||
ctx.canvas.settings = opts.canvas_settings.clone();
|
ctx.canvas.settings = opts.canvas_settings.clone();
|
||||||
|
|
||||||
let cs = ColorScheme::new(ctx, opts.color_scheme);
|
let cs = ColorScheme::new(ctx, opts.color_scheme);
|
||||||
// Start with a blank map
|
// Start with a minimal map
|
||||||
let map = Map::blank();
|
let map = Map::almost_blank();
|
||||||
let draw_map = DrawMap::new(ctx, &map, &opts, &cs, &mut Timer::throwaway());
|
let draw_map = DrawMap::new(ctx, &map, &opts, &cs, &mut Timer::throwaway());
|
||||||
let app = SimpleApp {
|
let mut app = SimpleApp {
|
||||||
map,
|
map,
|
||||||
draw_map,
|
draw_map,
|
||||||
cs,
|
cs,
|
||||||
@ -123,15 +123,19 @@ impl<T: 'static> SimpleApp<T> {
|
|||||||
time: Time::START_OF_DAY,
|
time: Time::START_OF_DAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
let states = vec![MapLoader::new_state(
|
let states = if let Some(map_name) = map_name {
|
||||||
ctx,
|
vec![MapLoader::new_state(
|
||||||
&app,
|
ctx,
|
||||||
map_name,
|
&app,
|
||||||
Box::new(move |ctx, app| {
|
map_name,
|
||||||
URLManager::change_camera(ctx, cam.as_ref(), app.map().get_gps_bounds());
|
Box::new(move |ctx, app| {
|
||||||
Transition::Clear(init_states(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)
|
(app, states)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user