fix bug where commands scheduled at tick 0 were skipped

This commit is contained in:
Dustin Carlino 2018-10-10 09:23:18 -07:00
parent 6dad7155aa
commit e681032866

View File

@ -138,8 +138,6 @@ impl Sim {
} }
fn inner_step(&mut self, map: &Map, control_map: &ControlMap) -> Result<(Vec<Event>), Error> { fn inner_step(&mut self, map: &Map, control_map: &ControlMap) -> Result<(Vec<Event>), Error> {
self.time = self.time.next();
let mut view = WorldView::new(); let mut view = WorldView::new();
let mut events: Vec<Event> = Vec::new(); let mut events: Vec<Event> = Vec::new();
@ -216,6 +214,10 @@ impl Sim {
} }
} }
// Do this at the end of the step, so that tick 0 actually occurs and things can happen
// then.
self.time = self.time.next();
Ok(events) Ok(events)
} }