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

Method apply_turn

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

Applies a turn message to this GameWorld, and ends the current turn. Returns the message to send to the next player.

(&mut self, turn: &TurnMessage, time_left_ms: i32)

Source from the content-addressed store, hash-verified

2238 /// Applies a turn message to this GameWorld, and ends the current turn.
2239 /// Returns the message to send to the next player.
2240 pub(crate) fn apply_turn(&mut self, turn: &TurnMessage, time_left_ms: i32) -> (StartTurnMessage, i32) {
2241 let mut error = 0;
2242 for delta in turn.changes.iter() {
2243 if self.apply(delta).is_err() {
2244 error = 1;
2245 break;
2246 }
2247 }
2248 (self.end_turn(time_left_ms), error)
2249 }
2250
2251 fn are_all_units_dead(&self) -> bool {
2252 return self.get_planet(Planet::Earth).units.is_empty() &&

Callers 1

make_actionMethod · 0.45

Calls 2

applyMethod · 0.80
end_turnMethod · 0.45

Tested by

no test coverage detected