rust/hedgewars-server/src/handlers/inroom.rs
changeset 15347 136023417164
parent 15132 1e45db229f9f
child 15463 a158ff8f84ef
equal deleted inserted replaced
15346:11b3d4869f6d 15347:136023417164
    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                     }