diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2020-04-11 14:18:57 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2020-04-11 14:18:57 +0200 |
commit | a516e9a639226505964144d16bffacee82c058a5 (patch) | |
tree | 86163ea612f5ece685e20c36f46abec96e3faa7b /src/state.rs | |
parent | 8e8ffe4b5d516e01ee7480e6989c3a309dee8b91 (diff) |
Better move heuristics
Diffstat (limited to 'src/state.rs')
-rw-r--r-- | src/state.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs index ecbd408..99239ae 100644 --- a/src/state.rs +++ b/src/state.rs @@ -38,6 +38,10 @@ pub struct Position { impl GameState { pub fn update(&mut self, commands: [Command; 2]) { + if self.status != GameStatus::Continue { + return; + } + self.do_command(0, &commands[0]); self.do_command(1, &commands[1]); self.update_player_collisions(); @@ -64,7 +68,6 @@ impl GameState { use Command::*; self.players[player_index].tick_boost(); - // TODO: Command validation assertions match command { Nothing => {} Accelerate => self.players[player_index].accelerate(), |