oops, nonsense option to start moving cars

This commit is contained in:
Dustin Carlino 2018-10-16 12:14:44 -07:00
parent ebebce179a
commit 41817d3e91
2 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@ use abstutil::elapsed_seconds;
use ezgui::{Canvas, EventLoopMode, GfxCtx, Text, UserInput, TOP_RIGHT};
use objects::{ID, SIM};
use piston::input::Key;
use sim::{Benchmark, ScoreSummary, TIMESTEP};
use sim::{Benchmark, CarState, ScoreSummary, TIMESTEP};
use std::mem;
use std::time::{Duration, Instant};
use ui::PerMapUI;
@ -105,7 +105,9 @@ impl SimController {
}
match primary.current_selection {
Some(ID::Car(id)) => {
if input.key_pressed(Key::A, "start this parked car") {
if primary.sim.get_car_state(id) == CarState::Parked
&& input.key_pressed(Key::A, "start this parked car")
{
primary.sim.start_parked_car(&primary.map, id);
}
}

View File

@ -253,6 +253,7 @@ fn time_parsing() {
assert_eq!(Tick::parse("01:02:03.5"), Some(Tick(35 + 1200 + 36000)));
}
#[derive(PartialEq, Eq)]
pub enum CarState {
Moving,
Stuck,