(&self, worker_id: UnitID, structure_id: UnitID)
| 1375 | } |
| 1376 | |
| 1377 | fn ok_if_can_repair(&self, worker_id: UnitID, structure_id: UnitID) -> Result<(), GameError> { |
| 1378 | let worker = self.my_unit(worker_id)?; |
| 1379 | let structure = self.my_unit(structure_id)?; |
| 1380 | worker.ok_if_on_map()?; |
| 1381 | worker.ok_if_can_worker_act()?; |
| 1382 | if !worker.location().is_adjacent_to(structure.location()) { |
| 1383 | Err(GameError::OutOfRange)?; |
| 1384 | } |
| 1385 | if !structure.structure_is_built()? { |
| 1386 | Err(GameError::StructureNotYetBuilt)?; |
| 1387 | } |
| 1388 | Ok(()) |
| 1389 | } |
| 1390 | |
| 1391 | /// Whether the given worker can repair the given strucutre. Tests that the worker |
| 1392 | /// is able to execute a worker action, that the structure is built, and that the |
no test coverage detected