Creates and inserts a new unit into the game world, so that it can be referenced by ID. Used for testing only!!! ResearchLevelInvalid - the research level is invalid.
(&mut self, team: Team, location: MapLocation,
unit_type: UnitType)
| 914 | /// |
| 915 | /// * ResearchLevelInvalid - the research level is invalid. |
| 916 | pub(crate) fn create_unit(&mut self, team: Team, location: MapLocation, |
| 917 | unit_type: UnitType) -> Result<UnitID, GameError> { |
| 918 | let id = self.id_generator.next_id(); |
| 919 | let level = self.get_team(team).research.get_level(&unit_type); |
| 920 | let unit = Unit::new(id, team, unit_type, level, OnMap(location))?; |
| 921 | |
| 922 | self.insert_unit(unit); |
| 923 | Ok(id) |
| 924 | } |
| 925 | |
| 926 | /// Destroys a unit. Removes any traces of it. |
| 927 | /// |