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

Method load

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

Loads the robot into the garrison of the structure. NoSuchUnit - either unit does not exist (inside the vision range). TeamNotAllowed - either unit is not on the current player's team. UnitNotOnMap - either unit is not on the map. Overheated - the robot is not ready to move again. InappropriateUnitType - the first unit is not a structure, or the second unit is not a robot. StructureNotYetBuilt -

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

Source from the content-addressed store, hash-verified

1786 /// * GarrisonFull - the structure's garrison is already full.
1787 /// * OutOfRange - the robot is not adjacent to the structure.
1788 pub fn load(&mut self, structure_id: UnitID, robot_id: UnitID)
1789 -> Result<(), GameError> {
1790 self.ok_if_can_load(structure_id, robot_id)?;
1791 self.remove_unit(robot_id);
1792 self.my_unit_mut(structure_id).unwrap().load(robot_id);
1793 self.my_unit_mut(robot_id).unwrap().board_rocket(structure_id);
1794 Ok(())
1795 }
1796
1797 fn ok_if_can_unload(&self, structure_id: UnitID, direction: Direction)
1798 -> Result<(), GameError> {

Callers 2

process_factoriesMethod · 0.45
applyMethod · 0.45

Calls 4

remove_unitMethod · 0.80
my_unit_mutMethod · 0.80
board_rocketMethod · 0.80
ok_if_can_loadMethod · 0.45

Tested by

no test coverage detected