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