The single unit with this ID. Use this method to get detailed statistics on a unit: heat, cooldowns, and properties of special abilities like units garrisoned in a rocket. NoSuchUnit - the unit does not exist (inside the vision range).
(&mut self, id: UnitID)
| 458 | /// |
| 459 | /// * NoSuchUnit - the unit does not exist (inside the vision range). |
| 460 | fn unit_mut(&mut self, id: UnitID) -> Result<&mut Unit, GameError> { |
| 461 | if self.my_planet().units.contains_key(&id) { |
| 462 | Ok(self.my_planet_mut().units.get_mut(&id).unwrap()) |
| 463 | } else if self.my_team().units_in_space.contains_key(&id) { |
| 464 | Ok(self.my_team_mut().units_in_space.get_mut(&id).unwrap()) |
| 465 | } else { |
| 466 | Err(GameError::NoSuchUnit)? |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | /// The single unit with this ID. Use this method to get detailed |
| 471 | /// statistics on a unit: heat, cooldowns, and properties of special |
no test coverage detected