(&mut self)
| 648 | } |
| 649 | |
| 650 | fn process_asteroids(&mut self) { |
| 651 | if self.asteroids.has_asteroid(self.round) { |
| 652 | let (location, karbonite) = { |
| 653 | let asteroid = self.asteroids.asteroid(self.round).unwrap(); |
| 654 | (asteroid.location, asteroid.karbonite) |
| 655 | }; |
| 656 | self.viewer_changes.push(ViewerDelta::AsteroidStrike { location, karbonite }); |
| 657 | if let Some(id) = self.get_planet(location.planet).units_by_loc.get(&location) { |
| 658 | if self.get_unit(*id).unwrap().unit_type().is_structure() { |
| 659 | return; |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | let new_amount = { |
| 664 | let planet_info = self.get_planet_mut(location.planet); |
| 665 | planet_info.karbonite[location.y as usize][location.x as usize] += karbonite; |
| 666 | planet_info.karbonite[location.y as usize][location.x as usize] |
| 667 | }; |
| 668 | self.viewer_changes.push(ViewerDelta::KarboniteChanged { |
| 669 | location: location, |
| 670 | new_amount: new_amount, |
| 671 | }); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | // ************************************************************************ |
| 676 | // *********************** COMMUNICATION METHODS ************************** |
no test coverage detected