Fix crash when changing speed limit. At some point, we started changing lane IDs for every road edit and never updated this. Closes #685

This commit is contained in:
Dustin Carlino 2021-07-02 11:54:59 -07:00
parent 4fd86c8a41
commit 6c1c6a3235

View File

@ -262,17 +262,9 @@ impl State<App> for RoadEditor {
Outcome::Changed(x) => match x.as_ref() { Outcome::Changed(x) => match x.as_ref() {
"speed limit" => { "speed limit" => {
let speed_limit = self.main_panel.dropdown_value("speed limit"); let speed_limit = self.main_panel.dropdown_value("speed limit");
let mut edits = app.primary.map.get_edits().clone(); return self.modify_current_lane(ctx, app, Some(0), |new, _| {
edits
.commands
.push(app.primary.map.edit_road_cmd(self.r, |new| {
new.speed_limit = speed_limit; new.speed_limit = speed_limit;
})); });
apply_map_edits(ctx, app, edits);
self.redo_stack.clear();
// Lane IDs don't change
self.recalc_all_panels(ctx, app);
} }
"width" => { "width" => {
let width = self.main_panel.dropdown_value("width"); let width = self.main_panel.dropdown_value("width");