MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / repair

Method repair

battlecode-engine/src/world.rs:1409–1416  ·  view source on GitHub ↗

Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built. NoSuchUnit - either unit does not exist (within the vision range). TeamNotAllowed - either unit is not on the current player's team. UnitNotOnMap - the worker is not on the map. InappropriateUnitType - the unit is not a worker, or the target is not a structure. Ov

(&mut self, worker_id: UnitID, structure_id: UnitID)

Source from the content-addressed store, hash-verified

1407 /// * OutOfRange - the worker is not adjacent to the structure.
1408 /// * StructureNotYetBuilt - the structure has not been completed.
1409 pub fn repair(&mut self, worker_id: UnitID, structure_id: UnitID) -> Result<(), GameError> {
1410 self.ok_if_can_repair(worker_id, structure_id)?;
1411 self.my_unit_mut(worker_id).unwrap().worker_act();
1412
1413 let repair_health = self.my_unit(worker_id).unwrap().worker_repair_health().unwrap();
1414 self.my_unit_mut(structure_id).unwrap().be_healed(repair_health);
1415 Ok(())
1416 }
1417
1418 fn ok_if_can_replicate(&self, worker_id: UnitID, direction: Direction)
1419 -> Result<(), GameError> {

Callers 1

applyMethod · 0.45

Calls 6

ok_if_can_repairMethod · 0.80
worker_actMethod · 0.80
my_unit_mutMethod · 0.80
worker_repair_healthMethod · 0.80
my_unitMethod · 0.80
be_healedMethod · 0.80

Tested by

no test coverage detected