From 595c1cf576677415b7d76f620e30032734d61c85 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Sat, 21 Jul 2018 12:22:13 +0200 Subject: Pulls a change out of a loop --- src/engine/bitwise_engine.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs index dd9ba93..99e4d92 100644 --- a/src/engine/bitwise_engine.rs +++ b/src/engine/bitwise_engine.rs @@ -309,13 +309,13 @@ impl BitwiseGameState { let top_row_mask = 255u64 << (top_row * SINGLE_MAP_WIDTH); let mut destroy_mask = top_row_mask.wrapping_shl(missed_cells) & top_row_mask; + let mut hits = 0; for _ in 0..(if tesla.pos.y == 0 || tesla.pos.y == MAP_HEIGHT-1 { 2 } else { 3 }) { - let hits = destroy_mask & opponent_buildings.buildings[0]; + hits |= destroy_mask & opponent_buildings.buildings[0]; destroy_mask &= !hits; - //TODO: This can probably be pulled out of the loop - BitwiseGameState::destroy_buildings(opponent_buildings, hits); destroy_mask = destroy_mask << SINGLE_MAP_WIDTH; } + BitwiseGameState::destroy_buildings(opponent_buildings, hits); } } } -- cgit v1.2.3