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

Method ok_if_can_unload

battlecode-engine/src/world.rs:1797–1809  ·  view source on GitHub ↗
(&self, structure_id: UnitID, direction: Direction)

Source from the content-addressed store, hash-verified

1795 }
1796
1797 fn ok_if_can_unload(&self, structure_id: UnitID, direction: Direction)
1798 -> Result<(), GameError> {
1799 let structure = self.my_unit(structure_id)?;
1800 structure.ok_if_on_map()?;
1801 structure.ok_if_can_unload_unit()?;
1802 let robot = self.my_unit(structure.structure_garrison()?[0])?;
1803 let loc = structure.location().map_location()?.add(direction);
1804 if !self.is_occupiable(loc)? {
1805 Err(GameError::LocationNotEmpty)?;
1806 }
1807 robot.ok_if_move_ready()?;
1808 Ok(())
1809 }
1810
1811 /// Tests whether the given structure is able to unload a unit in the
1812 /// given direction. There must be space in that direction, and the unit

Callers 2

can_unloadMethod · 0.80
unloadMethod · 0.80

Calls 9

my_unitMethod · 0.80
ok_if_on_mapMethod · 0.80
ok_if_can_unload_unitMethod · 0.80
structure_garrisonMethod · 0.80
map_locationMethod · 0.80
locationMethod · 0.80
addMethod · 0.45
is_occupiableMethod · 0.45
ok_if_move_readyMethod · 0.45

Tested by

no test coverage detected