mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
Revert "new rust version. finally strip_prefix is available!"
This reverts commit d16ac9713a
.
I'm seeing mysterious brokenness with fast_paths:
https://github.com/easbar/fast_paths/issues/20
Reverting so I can get work done
This commit is contained in:
parent
d16ac9713a
commit
d15a842e43
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
- uses: actions/checkout@master
|
||||
- uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
rust-version: 1.45.0
|
||||
rust-version: 1.43.0
|
||||
- name: Build game
|
||||
run: cargo build --release --bin game
|
||||
- name: Build importer
|
||||
@ -28,7 +28,7 @@ jobs:
|
||||
- uses: actions/checkout@master
|
||||
- uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
rust-version: 1.45.0
|
||||
rust-version: 1.43.0
|
||||
- name: Build game
|
||||
run: cargo build --release --bin game
|
||||
- name: Build importer
|
||||
@ -47,7 +47,7 @@ jobs:
|
||||
- uses: actions/checkout@master
|
||||
- uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
rust-version: 1.45.0
|
||||
rust-version: 1.43.0
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||
- name: Build game
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
You will first need:
|
||||
|
||||
- Stable Rust, at least 1.45. https://www.rust-lang.org/tools/install.
|
||||
- Stable Rust, at least 1.43. https://www.rust-lang.org/tools/install.
|
||||
- On Windows, you may need
|
||||
[Visual Studio 2019](https://visualstudio.microsoft.com/de/downloads/).
|
||||
- On Linux, `sudo apt-get install xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev`
|
||||
|
@ -89,8 +89,8 @@ impl State for TrafficSignalEditor {
|
||||
}
|
||||
|
||||
match self.composite.event(ctx) {
|
||||
Some(Outcome::Clicked(x)) => match x.as_ref() {
|
||||
"Edit entire signal" => {
|
||||
Some(Outcome::Clicked(x)) => match x {
|
||||
x if x == "Edit entire signal" => {
|
||||
return Transition::Push(edit_entire_signal(
|
||||
app,
|
||||
self.i,
|
||||
@ -98,7 +98,54 @@ impl State for TrafficSignalEditor {
|
||||
self.command_stack.get(0).cloned(),
|
||||
));
|
||||
}
|
||||
"Add new phase" => {
|
||||
x if x.starts_with("change duration of phase ") => {
|
||||
let idx = x["change duration of phase ".len()..]
|
||||
.parse::<usize>()
|
||||
.unwrap()
|
||||
- 1;
|
||||
return Transition::Push(change_duration(app, self.i, idx));
|
||||
}
|
||||
x if x.starts_with("delete phase ") => {
|
||||
let idx = x["delete phase ".len()..].parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.remove(idx);
|
||||
let num_phases = new_signal.phases.len();
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
// Don't use change_phase; it tries to preserve scroll
|
||||
self.current_phase = if idx == num_phases { idx - 1 } else { idx };
|
||||
self.composite =
|
||||
make_signal_diagram(ctx, app, self.i, self.current_phase, true);
|
||||
return Transition::Keep;
|
||||
}
|
||||
x if x.starts_with("move up phase ") => {
|
||||
let idx = x["move up phase ".len()..].parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.swap(idx, idx - 1);
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
self.change_phase(idx - 1, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
x if x.starts_with("move down phase ") => {
|
||||
let idx = x["move down phase ".len()..].parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.swap(idx, idx + 1);
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
self.change_phase(idx + 1, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
x if x == "Add new phase" => {
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.push(Phase::new());
|
||||
let len = new_signal.phases.len();
|
||||
@ -109,58 +156,11 @@ impl State for TrafficSignalEditor {
|
||||
self.change_phase(len - 1, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
x => {
|
||||
if let Some(x) = x.strip_prefix("change duration of phase ") {
|
||||
let idx = x.parse::<usize>().unwrap() - 1;
|
||||
return Transition::Push(change_duration(app, self.i, idx));
|
||||
}
|
||||
if let Some(x) = x.strip_prefix("delete phase ") {
|
||||
let idx = x.parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.remove(idx);
|
||||
let num_phases = new_signal.phases.len();
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
// Don't use change_phase; it tries to preserve scroll
|
||||
self.current_phase = if idx == num_phases { idx - 1 } else { idx };
|
||||
self.composite =
|
||||
make_signal_diagram(ctx, app, self.i, self.current_phase, true);
|
||||
return Transition::Keep;
|
||||
}
|
||||
if let Some(x) = x.strip_prefix("move up phase ") {
|
||||
let idx = x.parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.swap(idx, idx - 1);
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
self.change_phase(idx - 1, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
if let Some(x) = x.strip_prefix("move down phase ") {
|
||||
let idx = x.parse::<usize>().unwrap() - 1;
|
||||
|
||||
let mut new_signal = orig_signal.clone();
|
||||
new_signal.phases.swap(idx, idx + 1);
|
||||
self.command_stack.push(orig_signal.clone());
|
||||
self.redo_stack.clear();
|
||||
self.top_panel = make_top_panel(ctx, app, true, false);
|
||||
app.primary.map.incremental_edit_traffic_signal(new_signal);
|
||||
self.change_phase(idx + 1, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
if let Some(x) = x.strip_prefix("phase ") {
|
||||
let idx = x.parse::<usize>().unwrap() - 1;
|
||||
self.change_phase(idx, ctx, app);
|
||||
return Transition::Keep;
|
||||
}
|
||||
unreachable!()
|
||||
x if x.starts_with("phase ") => {
|
||||
let idx = x["phase ".len()..].parse::<usize>().unwrap() - 1;
|
||||
self.change_phase(idx, ctx, app);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
|
@ -106,11 +106,10 @@ impl State for BusRoutes {
|
||||
fn event(&mut self, ctx: &mut EventCtx, app: &mut App) -> Transition {
|
||||
match self.composite.event(ctx) {
|
||||
Some(Outcome::Clicked(x)) => {
|
||||
if let Some(x) = x.strip_prefix("BusRoute #") {
|
||||
let r = app
|
||||
.primary
|
||||
.map
|
||||
.get_br(BusRouteID(x.parse::<usize>().unwrap()));
|
||||
if x.starts_with("BusRoute #") {
|
||||
let r = app.primary.map.get_br(BusRouteID(
|
||||
x["BusRoute #".len()..].parse::<usize>().unwrap(),
|
||||
));
|
||||
let buses = app.primary.sim.status_of_buses(r.id);
|
||||
if buses.is_empty() {
|
||||
Transition::Push(msg(
|
||||
|
@ -243,18 +243,16 @@ impl State for EditScenarioModifiers {
|
||||
self.modifiers.clone(),
|
||||
));
|
||||
}
|
||||
x => {
|
||||
if let Some(x) = x.strip_prefix("delete modifier ") {
|
||||
self.modifiers.remove(x.parse::<usize>().unwrap() - 1);
|
||||
return Transition::Replace(EditScenarioModifiers::new(
|
||||
ctx,
|
||||
self.scenario_name.clone(),
|
||||
self.modifiers.clone(),
|
||||
));
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
x if x.starts_with("delete modifier ") => {
|
||||
let idx = x["delete modifier ".len()..].parse::<usize>().unwrap() - 1;
|
||||
self.modifiers.remove(idx);
|
||||
return Transition::Replace(EditScenarioModifiers::new(
|
||||
ctx,
|
||||
self.scenario_name.clone(),
|
||||
self.modifiers.clone(),
|
||||
));
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ impl Scheduler {
|
||||
.replace_path_for_serialization(restore.pop().unwrap());
|
||||
}
|
||||
Command::SpawnPed(ref mut create_ped) => {
|
||||
create_ped.path = restore.pop().unwrap();
|
||||
std::mem::replace(&mut create_ped.path, restore.pop().unwrap());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user