Update the current research and process any completed upgrades.
(&mut self, team: Team)
| 1183 | |
| 1184 | /// Update the current research and process any completed upgrades. |
| 1185 | fn process_research(&mut self, team: Team) { |
| 1186 | if let Some(branch) = self.get_team_mut(team).research.end_round() { |
| 1187 | for (_, unit) in self.get_planet_mut(Planet::Earth).units.iter_mut() { |
| 1188 | if unit.unit_type() == branch && unit.team() == team { |
| 1189 | unit.research().expect("research level is valid"); |
| 1190 | } |
| 1191 | } |
| 1192 | for (_, unit) in self.get_planet_mut(Planet::Mars).units.iter_mut() { |
| 1193 | if unit.unit_type() == branch && unit.team() == team { |
| 1194 | unit.research().expect("research level is valid"); |
| 1195 | } |
| 1196 | } |
| 1197 | for (_, unit) in self.get_team_mut(team).units_in_space.iter_mut() { |
| 1198 | if unit.unit_type() == branch { |
| 1199 | unit.research().expect("research level is valid"); |
| 1200 | } |
| 1201 | } |
| 1202 | self.viewer_changes.push(ViewerDelta::ResearchComplete { branch, team }); |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | // ************************************************************************ |
| 1207 | // *************************** WORKER METHODS ***************************** |