(&self, worker_id: UnitID, direction: Direction)
| 1208 | // ************************************************************************ |
| 1209 | |
| 1210 | fn ok_if_can_harvest(&self, worker_id: UnitID, direction: Direction) -> Result<(), GameError> { |
| 1211 | let unit = self.my_unit(worker_id)?; |
| 1212 | unit.ok_if_can_worker_act()?; |
| 1213 | let harvest_loc = unit.location().map_location()?.add(direction); |
| 1214 | // Check to see if we can sense the harvest location, (e.g. it is on the map). |
| 1215 | if self.karbonite_at(harvest_loc)? == 0 { |
| 1216 | Err(GameError::KarboniteDepositEmpty)?; |
| 1217 | } |
| 1218 | Ok(()) |
| 1219 | } |
| 1220 | |
| 1221 | /// Whether the worker is ready to harvest, and the given direction contains |
| 1222 | /// karbonite to harvest. The worker cannot already have performed an action |
no test coverage detected