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

Method move_from_space

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

Moves this rocket and any location-based indexing from space to this planet. Must currently be in space. Also move all the units inside it.

(&mut self, rocket_id: UnitID)

Source from the content-addressed store, hash-verified

889 /// Moves this rocket and any location-based indexing from space to this
890 /// planet. Must currently be in space. Also move all the units inside it.
891 fn move_from_space(&mut self, rocket_id: UnitID) {
892 let rocket = self.my_team_mut().units_in_space.remove(&rocket_id).expect("unit exists");
893
894 for id in rocket.structure_garrison().expect("unit is a rocket") {
895 let unit = self.my_team_mut().units_in_space.remove(&id).expect("unit exists");
896 self.my_planet_mut().units.insert(id, unit);
897 }
898
899 self.my_planet_mut().units.insert(rocket_id, rocket);
900 self.place_unit(rocket_id);
901 }
902
903 /// Inserts a new unit into the internal data structures of the game world,
904 /// assuming it is on the map.

Callers 1

land_rocketMethod · 0.80

Calls 4

my_team_mutMethod · 0.80
structure_garrisonMethod · 0.80
my_planet_mutMethod · 0.80
place_unitMethod · 0.80

Tested by

no test coverage detected