equal
deleted
inserted
replaced
47 const NON_TIMED_MESSAGES: &[u8] = b"M#hb"; |
47 const NON_TIMED_MESSAGES: &[u8] = b"M#hb"; |
48 |
48 |
49 #[cfg(canhazslicepatterns)] |
49 #[cfg(canhazslicepatterns)] |
50 fn is_msg_valid(msg: &[u8], team_indices: &[u8]) -> bool { |
50 fn is_msg_valid(msg: &[u8], team_indices: &[u8]) -> bool { |
51 match msg { |
51 match msg { |
52 [size, typ, body..] => { |
52 [size, typ, body..MAX] => { |
53 VALID_MESSAGES.contains(typ) |
53 VALID_MESSAGES.contains(typ) |
54 && match body { |
54 && match body { |
55 [1...MAX_HEDGEHOGS_PER_TEAM, team, ..] if *typ == b'h' => { |
55 [1...MAX_HEDGEHOGS_PER_TEAM, team, ..] if *typ == b'h' => { |
56 team_indices.contains(team) |
56 team_indices.contains(team) |
57 } |
57 } |