diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-07-21 23:21:15 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-07-21 23:21:15 +0200 |
commit | 8fdd6e813c4b88332f0e91350dab7d080087aee2 (patch) | |
tree | a5972dcee9ea4727fe284d8d3deae5ef567e36ef /src/engine | |
parent | deef6b8e3f29a6baac5c545e7f586c6fbfa437ba (diff) |
Moved change to all buildings outside of missile update loop
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/bitwise_engine.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs index 1d7e424..8a3157e 100644 --- a/src/engine/bitwise_engine.rs +++ b/src/engine/bitwise_engine.rs @@ -365,6 +365,7 @@ impl BitwiseGameState { } fn move_and_collide_missiles(opponent: &mut Player, opponent_buildings: &mut PlayerBuildings, player_missiles: &mut [(u64, u64); MISSILE_MAX_SINGLE_CELL]) { + let mut destroyed = 0; for _ in 0..MISSILE_SPEED { for i in 0..MISSILE_MAX_SINGLE_CELL { let about_to_hit_opponent = player_missiles[i].1 & LEFT_COL_MASK; @@ -382,11 +383,11 @@ impl BitwiseGameState { player_missiles[i].1 &= !hits; opponent_buildings.buildings[health_tier] &= !hits; } - - BitwiseGameState::destroy_buildings(opponent_buildings, hits); - BitwiseGameState::update_tesla_activity(opponent_buildings); + destroyed |= hits; } } + BitwiseGameState::destroy_buildings(opponent_buildings, destroyed); + BitwiseGameState::update_tesla_activity(opponent_buildings); } fn destroy_buildings(buildings: &mut PlayerBuildings, hit_mask: u64) { |