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