mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-18 20:02:18 +03:00
Output lane width as feet in the Streetmix export, not meters.
Also few unrelated tiny wording changes in the experiment
This commit is contained in:
parent
f6db70b0e5
commit
3c2c3cda5a
@ -63,7 +63,7 @@ impl Game {
|
|||||||
let status_panel = Panel::new(Widget::col(vec![
|
let status_panel = Panel::new(Widget::col(vec![
|
||||||
"Complete Deliveries".draw_text(ctx).named("score label"),
|
"Complete Deliveries".draw_text(ctx).named("score label"),
|
||||||
Widget::draw_batch(ctx, GeomBatch::new()).named("score"),
|
Widget::draw_batch(ctx, GeomBatch::new()).named("score"),
|
||||||
"Remaining Gifts".draw_text(ctx).named("energy label"),
|
"Remaining Presents".draw_text(ctx).named("energy label"),
|
||||||
Widget::draw_batch(ctx, GeomBatch::new()).named("energy"),
|
Widget::draw_batch(ctx, GeomBatch::new()).named("energy"),
|
||||||
]))
|
]))
|
||||||
.aligned(HorizontalAlignment::RightInset, VerticalAlignment::TopInset)
|
.aligned(HorizontalAlignment::RightInset, VerticalAlignment::TopInset)
|
||||||
@ -298,7 +298,7 @@ impl Game {
|
|||||||
if self.state.has_energy() {
|
if self.state.has_energy() {
|
||||||
if self.state.energyless_arrow.is_some() {
|
if self.state.energyless_arrow.is_some() {
|
||||||
self.state.energyless_arrow = None;
|
self.state.energyless_arrow = None;
|
||||||
let label = "Remaining Gifts".draw_text(ctx);
|
let label = "Remaining Presents".draw_text(ctx);
|
||||||
self.status_panel.replace(ctx, "energy label", label);
|
self.status_panel.replace(ctx, "energy label", label);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -308,7 +308,8 @@ impl Game {
|
|||||||
app.time,
|
app.time,
|
||||||
self.state.bldgs.all_stores(),
|
self.state.bldgs.all_stores(),
|
||||||
));
|
));
|
||||||
let label = Text::from(Line("Out of gifts - refill from a store!").fg(Color::RED))
|
let label =
|
||||||
|
Text::from(Line("Out of presents - refill from a store!").fg(Color::RED))
|
||||||
.draw(ctx);
|
.draw(ctx);
|
||||||
self.status_panel.replace(ctx, "energy label", label);
|
self.status_panel.replace(ctx, "energy label", label);
|
||||||
}
|
}
|
||||||
@ -479,7 +480,7 @@ struct GameState {
|
|||||||
|
|
||||||
// Number of deliveries
|
// Number of deliveries
|
||||||
score: usize,
|
score: usize,
|
||||||
// Number of gifts currently being carried
|
// Number of presents currently being carried
|
||||||
energy: usize,
|
energy: usize,
|
||||||
boost: Duration,
|
boost: Duration,
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ fn road(id: RoadID, map: &Map) -> serde_json::Map<String, serde_json::value::Val
|
|||||||
fn lane(lane: &Lane, dir: Direction) -> serde_json::Map<String, serde_json::value::Value> {
|
fn lane(lane: &Lane, dir: Direction) -> serde_json::Map<String, serde_json::value::Value> {
|
||||||
let mut segment = serde_json::Map::new();
|
let mut segment = serde_json::Map::new();
|
||||||
segment.insert("id".to_string(), lane.id.to_string().into());
|
segment.insert("id".to_string(), lane.id.to_string().into());
|
||||||
segment.insert("width".to_string(), lane.width.inner_meters().into());
|
segment.insert("width".to_string(), lane.width.to_feet().into());
|
||||||
|
|
||||||
// TODO I'm taking wild stabs at these values for now. Once I can visualize the results, will
|
// TODO I'm taking wild stabs at these values for now. Once I can visualize the results, will
|
||||||
// iterate on these.
|
// iterate on these.
|
||||||
|
@ -68,6 +68,11 @@ impl Distance {
|
|||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the distance in feet.
|
||||||
|
pub fn to_feet(self) -> f64 {
|
||||||
|
self.0 * 3.28084
|
||||||
|
}
|
||||||
|
|
||||||
/// Describes the distance according to formatting rules.
|
/// Describes the distance according to formatting rules.
|
||||||
pub fn to_string(self, fmt: &UnitFmt) -> String {
|
pub fn to_string(self, fmt: &UnitFmt) -> String {
|
||||||
if fmt.metric {
|
if fmt.metric {
|
||||||
@ -78,7 +83,7 @@ impl Distance {
|
|||||||
format!("{}km", (km * 10.0).round() / 10.0)
|
format!("{}km", (km * 10.0).round() / 10.0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let feet = self.0 * 3.28084;
|
let feet = self.to_feet();
|
||||||
let miles = feet / 5280.0;
|
let miles = feet / 5280.0;
|
||||||
if miles >= 0.1 {
|
if miles >= 0.1 {
|
||||||
format!("{} miles", (miles * 10.0).round() / 10.0)
|
format!("{} miles", (miles * 10.0).round() / 10.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user