rust/hedgewars-server/src/handlers/inroom.rs
changeset 15530 a859f08ebb4f
parent 15528 17ad5d43e820
child 15531 ede5f4ec48f3
equal deleted inserted replaced
15529:cc774c6e933e 15530:a859f08ebb4f
    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                     }