MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / ok_if_can_load

Method ok_if_can_load

battlecode-engine/src/world.rs:1756–1768  ·  view source on GitHub ↗
(&self, structure_id: UnitID, robot_id: UnitID)

Source from the content-addressed store, hash-verified

1754 // ************************************************************************
1755
1756 fn ok_if_can_load(&self, structure_id: UnitID, robot_id: UnitID)
1757 -> Result<(), GameError> {
1758 let robot = self.my_unit(robot_id)?;
1759 let structure = self.my_unit(structure_id)?;
1760 robot.ok_if_on_map()?;
1761 structure.ok_if_on_map()?;
1762 robot.ok_if_move_ready()?;
1763 structure.ok_if_can_load()?;
1764 if !structure.location().is_adjacent_to(robot.location()) {
1765 Err(GameError::OutOfRange)?;
1766 }
1767 Ok(())
1768 }
1769
1770 /// Whether the robot can be loaded into the given structure's garrison. The robot
1771 /// must be ready to move and must be adjacent to the structure. The structure

Callers 2

can_loadMethod · 0.45
loadMethod · 0.45

Calls 5

my_unitMethod · 0.80
ok_if_on_mapMethod · 0.80
is_adjacent_toMethod · 0.80
locationMethod · 0.80
ok_if_move_readyMethod · 0.45

Tested by

no test coverage detected