(&self, structure_id: UnitID, direction: Direction)
| 1795 | } |
| 1796 | |
| 1797 | fn ok_if_can_unload(&self, structure_id: UnitID, direction: Direction) |
| 1798 | -> Result<(), GameError> { |
| 1799 | let structure = self.my_unit(structure_id)?; |
| 1800 | structure.ok_if_on_map()?; |
| 1801 | structure.ok_if_can_unload_unit()?; |
| 1802 | let robot = self.my_unit(structure.structure_garrison()?[0])?; |
| 1803 | let loc = structure.location().map_location()?.add(direction); |
| 1804 | if !self.is_occupiable(loc)? { |
| 1805 | Err(GameError::LocationNotEmpty)?; |
| 1806 | } |
| 1807 | robot.ok_if_move_ready()?; |
| 1808 | Ok(()) |
| 1809 | } |
| 1810 | |
| 1811 | /// Tests whether the given structure is able to unload a unit in the |
| 1812 | /// given direction. There must be space in that direction, and the unit |
no test coverage detected