fn send_snapshots(&mut self) {
let mut peer_set = self.server.send_snapshots_peer_set.take();
peer_set.clear();
peer_set.extend(self.server.peers.keys());
for snap_pid in &peer_set {
let mut builder;
let delta_tick;
let snap_ingame = if let PeerState::Ingame(ref mut ingame) = self.server.peers[snap_pid].state {
builder = ingame.snaps.new_builder();
delta_tick = ingame.snaps.delta_tick().unwrap_or(-1);
ingame
} else {
continue;
};
builder.add(0, GameInfo {
game_flags: 0,
game_state_flags: 0,
round_start_tick: Tick(0),
warmup_timer: 0,
score_limit: 20,
time_limit: 0,
round_num: 1,
round_current: 1,
});
if let Some(mode) = &snap_ingame.spectator_mode {
builder.add(snap_pid.0.assert_u16(), SpectatorInfo {
spectator_id: mode.to_net(),
x: snap_ingame.input.target_x,
y: snap_ingame.input.target_y,
});
}
...