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

Method unload

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

Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded. NoSuchUnit - the unit does not exist (inside the vision range). TeamNotAllowed - either unit is not on the current player's team. UnitNotOnMap - the structure is not on the map. InappropriateUnitType - the unit is not a structure. StructureNotYetBuilt - the struc

(&mut self, structure_id: UnitID, direction: Direction)

Source from the content-addressed store, hash-verified

1829 /// occupied.
1830 /// * Overheated - the robot inside the structure is not ready to move again.
1831 pub fn unload(&mut self, structure_id: UnitID, direction: Direction)
1832 -> Result<(), GameError> {
1833 self.ok_if_can_unload(structure_id, direction)?;
1834 let (robot_id, structure_loc) = {
1835 let structure = self.my_unit_mut(structure_id)?;
1836 (structure.unload_unit(), structure.location().map_location()?)
1837 };
1838 let robot_loc = structure_loc.add(direction);
1839 self.my_unit_mut(robot_id)?.move_to(robot_loc);
1840 self.place_unit(robot_id);
1841 Ok(())
1842 }
1843
1844 // ************************************************************************
1845 // ************************** FACTORY METHODS *****************************

Callers 4

run.pyFile · 0.45
run.pyFile · 0.45
applyMethod · 0.45
examplefuncsplayerFunction · 0.45

Calls 8

ok_if_can_unloadMethod · 0.80
my_unit_mutMethod · 0.80
unload_unitMethod · 0.80
map_locationMethod · 0.80
locationMethod · 0.80
place_unitMethod · 0.80
addMethod · 0.45
move_toMethod · 0.45

Tested by

no test coverage detected