The unit at the location, if it exists. LocationOffMap - the location is off the map. LocationNotVisible - the location is outside the vision range.
(&self, location: MapLocation)
| 621 | /// * LocationOffMap - the location is off the map. |
| 622 | /// * LocationNotVisible - the location is outside the vision range. |
| 623 | pub fn sense_unit_at_location(&self, location: MapLocation) |
| 624 | -> Result<Option<Unit>, GameError> { |
| 625 | self.ok_if_can_sense_location(location)?; |
| 626 | let unit_id = self.my_planet().units_by_loc.get(&location); |
| 627 | Ok(unit_id.map(|id| self.unit(*id).expect("unit exists").clone())) |
| 628 | } |
| 629 | |
| 630 | // ************************************************************************ |
| 631 | // ************************** WEATHER METHODS ***************************** |