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

Method process_research

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

Update the current research and process any completed upgrades.

(&mut self, team: Team)

Source from the content-addressed store, hash-verified

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 *****************************

Callers 2

end_roundMethod · 0.80

Calls 6

get_team_mutMethod · 0.80
get_planet_mutMethod · 0.80
unit_typeMethod · 0.80
researchMethod · 0.80
end_roundMethod · 0.45
teamMethod · 0.45

Tested by 1