Marginally faster tesla activity update
authorJustin Worthe <justin@worthe-it.co.za>
Sat, 21 Jul 2018 18:45:46 +0000 (20:45 +0200)
committerJustin Worthe <justin@worthe-it.co.za>
Sat, 21 Jul 2018 18:45:46 +0000 (20:45 +0200)
src/engine/bitwise_engine.rs

index 9dfd449..1d7e424 100644 (file)
@@ -403,8 +403,8 @@ impl BitwiseGameState {
     }
 
     fn update_tesla_activity(buildings: &mut PlayerBuildings) {
-        for tesla in buildings.tesla_cooldowns.iter_mut().filter(|t| t.active) {
-            tesla.active = (tesla.pos.to_either_bitfield() & buildings.occupied) != 0;
+        for i in 0..TESLA_MAX {
+            buildings.tesla_cooldowns[i].active = buildings.tesla_cooldowns[i].active && (buildings.tesla_cooldowns[i].pos.to_either_bitfield() & buildings.occupied) != 0;
         }
     }