jump to stop sign editor from sandbox mode too

This commit is contained in:
Dustin Carlino 2020-01-18 16:57:15 -08:00
parent afcd694524
commit 7d238ceff5
2 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,7 @@ mod stop_signs;
mod traffic_signals; mod traffic_signals;
use self::lanes::{Brush, LaneEditor}; use self::lanes::{Brush, LaneEditor};
pub use self::stop_signs::StopSignEditor;
pub use self::traffic_signals::TrafficSignalEditor; pub use self::traffic_signals::TrafficSignalEditor;
use crate::common::{tool_panel, CommonState, Warping}; use crate::common::{tool_panel, CommonState, Warping};
use crate::debug::DebugMode; use crate::debug::DebugMode;
@ -128,9 +129,7 @@ impl State for EditMode {
.per_obj .per_obj
.action(ctx, Key::E, format!("edit stop signs for {}", id)) .action(ctx, Key::E, format!("edit stop signs for {}", id))
{ {
return Transition::Push(Box::new(stop_signs::StopSignEditor::new( return Transition::Push(Box::new(StopSignEditor::new(id, ctx, ui)));
id, ctx, ui,
)));
} else if ui } else if ui
.primary .primary
.map .map

View File

@ -7,7 +7,7 @@ mod speed;
pub use self::overlays::Overlays; pub use self::overlays::Overlays;
use crate::common::{tool_panel, CommonState, Minimap}; use crate::common::{tool_panel, CommonState, Minimap};
use crate::debug::DebugMode; use crate::debug::DebugMode;
use crate::edit::{apply_map_edits, save_edits, EditMode, TrafficSignalEditor}; use crate::edit::{apply_map_edits, save_edits, EditMode, StopSignEditor, TrafficSignalEditor};
use crate::game::{State, Transition, WizardState}; use crate::game::{State, Transition, WizardState};
use crate::helpers::ID; use crate::helpers::ID;
use crate::managed::Outcome; use crate::managed::Outcome;
@ -127,6 +127,14 @@ impl State for SandboxMode {
Box::new(TrafficSignalEditor::new(i, ctx, ui, sim_copy)), Box::new(TrafficSignalEditor::new(i, ctx, ui, sim_copy)),
); );
} }
if ui.primary.map.get_i(i).is_stop_sign()
&& ui.per_obj.action(ctx, Key::E, "edit stop sign")
{
return Transition::PushTwice(
Box::new(EditMode::new(ctx, ui, self.gameplay.mode.clone())),
Box::new(StopSignEditor::new(i, ctx, ui)),
);
}
} }
if let Some(ID::BusStop(bs)) = ui.primary.current_selection { if let Some(ID::BusStop(bs)) = ui.primary.current_selection {
let routes = ui.primary.map.get_routes_serving_stop(bs); let routes = ui.primary.map.get_routes_serving_stop(bs);