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

Method is_occupiable

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

Whether the location is clear for a unit to occupy, either by movement or by construction. LocationOffMap - the location is off the map. LocationNotVisible - the location is outside the vision range.

(&self, location: MapLocation)

Source from the content-addressed store, hash-verified

980 /// * LocationOffMap - the location is off the map.
981 /// * LocationNotVisible - the location is outside the vision range.
982 pub fn is_occupiable(&self, location: MapLocation) -> Result<bool, GameError> {
983 self.ok_if_can_sense_location(location)?;
984
985 let planet_map = &self.starting_map(location.planet);
986 Ok(planet_map.is_passable_terrain_at(location).unwrap() &&
987 !self.my_planet().units_by_loc.contains_key(&location))
988 }
989
990 /// * NoSuchUnit - the robot does not exist (within the vision range).
991 /// * TeamNotAllowed - the robot is not on the current player's team.

Callers 5

ok_if_can_moveMethod · 0.45
ok_if_can_blueprintMethod · 0.45
ok_if_can_replicateMethod · 0.45
ok_if_can_blinkMethod · 0.45
ok_if_can_unloadMethod · 0.45

Calls 4

my_planetMethod · 0.80
starting_mapMethod · 0.45

Tested by

no test coverage detected