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

Method ok_if_can_launch_rocket

battlecode-engine/src/world.rs:1929–1944  ·  view source on GitHub ↗
(&self, rocket_id: UnitID, destination: MapLocation)

Source from the content-addressed store, hash-verified

1927 }
1928
1929 fn ok_if_can_launch_rocket(&self, rocket_id: UnitID, destination: MapLocation)
1930 -> Result<(), GameError> {
1931 let rocket = self.my_unit(rocket_id)?;
1932 if destination.planet == self.planet() {
1933 Err(GameError::SamePlanet)?;
1934 }
1935 rocket.ok_if_can_launch_rocket()?;
1936 let map = &self.starting_map(destination.planet);
1937 if !map.on_map(destination) {
1938 Err(GameError::LocationOffMap)?;
1939 }
1940 if !map.is_passable_terrain_at(destination)? {
1941 Err(GameError::LocationNotEmpty)?;
1942 }
1943 Ok(())
1944 }
1945
1946 /// Whether the rocket can launch into space to the given destination. The
1947 /// rocket can launch if the it has never been used before. The destination

Callers 2

can_launch_rocketMethod · 0.45
launch_rocketMethod · 0.45

Calls 5

my_unitMethod · 0.80
on_mapMethod · 0.80
planetMethod · 0.45
starting_mapMethod · 0.45

Tested by

no test coverage detected