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

Method place_unit

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

Places the unit in location-based indexing and/or marks the unit info. Must be called after changing a unit's location within a planet.

(&mut self, id: UnitID)

Source from the content-addressed store, hash-verified

850 /// Places the unit in location-based indexing and/or marks the unit info.
851 /// Must be called after changing a unit's location within a planet.
852 fn place_unit(&mut self, id: UnitID) {
853 match self.my_unit(id)
854 .expect("Unit does not exist and cannot be placed.")
855 .location() {
856 OnMap(map_loc) => {
857 self.my_planet_mut().units_by_loc.insert(map_loc, id);
858 },
859 _ => panic!("Unit is not on a map and cannot be placed."),
860 }
861 }
862
863 /// Temporarily removes this unit from any location-based indexing.
864 /// Must be on the current planet and team before being removed.

Callers 4

move_from_spaceMethod · 0.80
move_toMethod · 0.80
blinkMethod · 0.80
unloadMethod · 0.80

Calls 3

locationMethod · 0.80
my_unitMethod · 0.80
my_planet_mutMethod · 0.80

Tested by

no test coverage detected