46 |
46 |
47 const VALID_MESSAGES: &[u8] = |
47 const VALID_MESSAGES: &[u8] = |
48 b"M#+LlRrUuDdZzAaSjJ,NpPwtgfhbc12345\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A"; |
48 b"M#+LlRrUuDdZzAaSjJ,NpPwtgfhbc12345\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A"; |
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..MAX] => { |
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 } |
60 _ => *typ != b'h', |
60 _ => *typ != b'h', |
61 } |
61 } |
62 } |
62 } |
63 _ => false, |
63 _ => false, |
64 } |
64 } |
65 }*/ |
65 } |
66 |
66 |
67 fn is_msg_valid(msg: &[u8], _team_indices: &[u8]) -> bool { |
67 fn is_msg_valid(msg: &[u8], _team_indices: &[u8]) -> bool { |
68 if let Some(typ) = msg.get(1) { |
68 if let Some(typ) = msg.get(1) { |
69 VALID_MESSAGES.contains(typ) |
69 VALID_MESSAGES.contains(typ) |
70 } else { |
70 } else { |