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

Method move_to_space

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

Moves this rocket and any location-based indexing to space. Must be on the current planet and team. Also moves all the units inside it.

(&mut self, rocket_id: UnitID)

Source from the content-addressed store, hash-verified

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.
878 fn move_to_space(&mut self, rocket_id: UnitID) {
879 self.remove_unit(rocket_id);
880
881 let rocket = self.my_planet_mut().units.remove(&rocket_id).expect("unit exists");
882 for id in rocket.structure_garrison().expect("unit is a rocket") {
883 let unit = self.my_planet_mut().units.remove(&id).expect("unit exists");
884 self.my_team_mut().units_in_space.insert(id, unit);
885 }
886 self.my_team_mut().units_in_space.insert(rocket_id, rocket);
887 }
888
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.

Callers 1

launch_rocketMethod · 0.80

Calls 4

remove_unitMethod · 0.80
my_planet_mutMethod · 0.80
structure_garrisonMethod · 0.80
my_team_mutMethod · 0.80

Tested by

no test coverage detected