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)
| 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. |
no test coverage detected