From 416ad2d3a0b6bf28b343d0951d6f8723bd63aef2 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Tue, 6 Aug 2019 15:50:45 +0200 Subject: Unfreezing over time --- src/constants.rs | 2 -- src/game.rs | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index 95f426f..08e39dd 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -141,8 +141,6 @@ pub const MAP_ROW_SIZE: [MapRow; MAP_SIZE] = [ pub const MAP_BITSIZE: usize = 897; pub const MAP_U64S: usize = 15; -// TODO: Constant for lava map - pub struct MapRow { pub start_bit: usize, pub x_offset: usize, diff --git a/src/game.rs b/src/game.rs index 3eb7b11..fca740d 100644 --- a/src/game.rs +++ b/src/game.rs @@ -187,7 +187,7 @@ impl GameBoard { self.simulate_select(moves); let actions = self.identify_actions(moves); - // TODO: Simulate frozen worms (nullify their actions) + self.simulate_moves(actions); self.simulate_digs(actions); self.simulate_bombs(actions); @@ -225,7 +225,12 @@ impl GameBoard { } fn simulate_tick_frozen_timers(&mut self) { - // TODO + self.players + .iter_mut() + .flat_map(|p| p.worms.iter_mut()) + .for_each(|ref mut w| { + w.rounds_until_unfrozen = w.rounds_until_unfrozen.saturating_sub(1) + }); } fn identify_actions(&self, moves: [Command; 2]) -> [Action; 2] { -- cgit v1.2.3