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

Method remove_unit

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

Temporarily removes this unit from any location-based indexing. Must be on the current planet and team before being removed.

(&mut self, id: UnitID)

Source from the content-addressed store, hash-verified

863 /// Temporarily removes this unit from any location-based indexing.
864 /// Must be on the current planet and team before being removed.
865 fn remove_unit(&mut self, id: UnitID) {
866 match self.my_unit(id)
867 .expect("Unit does not exist and cannot be removed.")
868 .location() {
869 OnMap(loc) => {
870 self.my_planet_mut().units_by_loc.remove(&loc);
871 },
872 _ => panic!("Unit is not on a map and cannot be removed."),
873 }
874 }
875
876 /// Moves this rocket and any location-based indexing to space. Must be
877 /// on the current planet and team. Also moves all the units inside it.

Callers 4

move_to_spaceMethod · 0.80
move_toMethod · 0.80
blinkMethod · 0.80
loadMethod · 0.80

Calls 3

locationMethod · 0.80
my_unitMethod · 0.80
my_planet_mutMethod · 0.80

Tested by

no test coverage detected