(&self, factory_id: UnitID, robot_type: UnitType)
| 1846 | // ************************************************************************ |
| 1847 | |
| 1848 | fn ok_if_can_produce_robot(&self, factory_id: UnitID, robot_type: UnitType) |
| 1849 | -> Result<(), GameError> { |
| 1850 | let factory = self.my_unit(factory_id)?; |
| 1851 | factory.ok_if_can_produce_robot(robot_type)?; |
| 1852 | let cost = robot_type.factory_cost().expect("unit type is ok"); |
| 1853 | if self.karbonite() < cost { |
| 1854 | Err(GameError::InsufficientKarbonite)?; |
| 1855 | } |
| 1856 | Ok(()) |
| 1857 | } |
| 1858 | |
| 1859 | /// Whether the factory can produce a robot of the given type. The factory |
| 1860 | /// must not currently be producing a robot, and the team must have |
no test coverage detected