NoSuchUnit - the robot does not exist (within the vision range). TeamNotAllowed - the robot is not on the current player's team. UnitNotOnMap - the robot is not on the map. LocationNotVisible - the location is outside the vision range. LocationOffMap - the location is off the map. LocationNotEmpty - the location is occupied by a unit or terrain.
(&self, robot_id: UnitID, direction: Direction)
| 994 | /// * LocationOffMap - the location is off the map. |
| 995 | /// * LocationNotEmpty - the location is occupied by a unit or terrain. |
| 996 | fn ok_if_can_move(&self, robot_id: UnitID, direction: Direction) -> Result<(), GameError> { |
| 997 | let unit = self.my_unit(robot_id)?; |
| 998 | let new_location = unit.location().map_location()?.add(direction); |
| 999 | |
| 1000 | self.ok_if_can_sense_location(new_location)?; |
| 1001 | if !self.is_occupiable(new_location).unwrap() { |
| 1002 | Err(GameError::LocationNotEmpty)?; |
| 1003 | } |
| 1004 | Ok(()) |
| 1005 | } |
| 1006 | |
| 1007 | /// Whether the robot can move in the given direction, without taking into |
| 1008 | /// account the unit's movement heat. Takes into account only the map |
no test coverage detected