Rearranged to make data flow clearer
authorJustin Worthe <justin@worthe-it.co.za>
Sat, 21 Jul 2018 21:47:55 +0000 (23:47 +0200)
committerJustin Worthe <justin@worthe-it.co.za>
Sat, 21 Jul 2018 21:47:55 +0000 (23:47 +0200)
src/engine/bitwise_engine.rs

index 49b780d..db31511 100644 (file)
@@ -369,14 +369,13 @@ impl BitwiseGameState {
         let mut damaging = 0;
         for _ in 0..MISSILE_SPEED {
             for i in 0..MISSILE_MAX_SINGLE_CELL {
+                let swapping_sides = player_missiles[i].0 & RIGHT_COL_MASK;
                 let about_to_hit_opponent = player_missiles[i].1 & LEFT_COL_MASK;
-                damaging = damaging << 1;
-                damaging |= about_to_hit_opponent;
-                player_missiles[i].1 = (player_missiles[i].1 & !LEFT_COL_MASK) >> 1;
 
-                let swapping_sides = player_missiles[i].0 & RIGHT_COL_MASK;
-                player_missiles[i].1 |= swapping_sides;
                 player_missiles[i].0 = (player_missiles[i].0 & !RIGHT_COL_MASK) << 1;
+                player_missiles[i].1 = ((player_missiles[i].1 & !LEFT_COL_MASK) >> 1) | swapping_sides;
+
+                damaging = (damaging << 1) | about_to_hit_opponent;
 
                 let mut hits = 0;
                 for health_tier in (0..DEFENCE_HEALTH).rev() {