summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-08-06 15:50:45 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-08-06 15:50:45 +0200
commit416ad2d3a0b6bf28b343d0951d6f8723bd63aef2 (patch)
tree669701fdac97f9b41fd49acd7333f4ae404e5872
parente2b32320c8531f266d22d9302c28b0e863a95ba0 (diff)
Unfreezing over time
-rw-r--r--src/constants.rs2
-rw-r--r--src/game.rs9
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] {