rust/hedgewars-server/src/protocol/test.rs
author Wuzzy <Wuzzy2@mail.ru>
Thu, 20 Dec 2018 18:23:13 +0100
changeset 14488 310b167141cc
parent 14462 98ef2913ec73
child 14788 b3adc030104b
permissions -rw-r--r--
Use player's team identity for SimpleMission-based mission
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
     1
use proptest::{
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
     2
    arbitrary::{any, any_with, Arbitrary, StrategyFor},
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
     3
    strategy::{BoxedStrategy, Just, Map, Strategy},
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
     4
    test_runner::{Reason, TestRunner},
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
     5
};
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
     6
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
     7
use crate::server::coretypes::{GameCfg, HedgehogInfo, TeamInfo};
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
     8
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
     9
use super::messages::{HWProtocolMessage, HWProtocolMessage::*};
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    10
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    11
// Due to inability to define From between Options
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    12
trait Into2<T>: Sized {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    13
    fn into2(self) -> T;
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    14
}
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    15
impl<T> Into2<T> for T {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    16
    fn into2(self) -> T {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    17
        self
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    18
    }
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    19
}
13438
fb104e150878 Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents: 13437
diff changeset
    20
impl Into2<Vec<String>> for Vec<Ascii> {
fb104e150878 Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents: 13437
diff changeset
    21
    fn into2(self) -> Vec<String> {
fb104e150878 Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents: 13437
diff changeset
    22
        self.into_iter().map(|x| x.0).collect()
fb104e150878 Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents: 13437
diff changeset
    23
    }
fb104e150878 Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents: 13437
diff changeset
    24
}
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    25
impl Into2<String> for Ascii {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    26
    fn into2(self) -> String {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    27
        self.0
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    28
    }
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    29
}
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    30
impl Into2<Option<String>> for Option<Ascii> {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    31
    fn into2(self) -> Option<String> {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    32
        self.map(|x| x.0)
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    33
    }
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    34
}
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    35
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    36
macro_rules! proto_msg_case {
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    37
    ($val: ident()) => {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    38
        Just($val)
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    39
    };
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    40
    ($val: ident($arg: ty)) => {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    41
        any::<$arg>().prop_map(|v| $val(v.into2()))
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    42
    };
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    43
    ($val: ident($arg1: ty, $arg2: ty)) => {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    44
        any::<($arg1, $arg2)>().prop_map(|v| $val(v.0.into2(), v.1.into2()))
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    45
    };
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    46
    ($val: ident($arg1: ty, $arg2: ty, $arg3: ty)) => {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    47
        any::<($arg1, $arg2, $arg3)>().prop_map(|v| $val(v.0.into2(), v.1.into2(), v.2.into2()))
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    48
    };
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    49
}
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    50
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    51
macro_rules! proto_msg_match {
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    52
    ($var: expr, def = $default: expr, $($num: expr => $constr: ident $res: tt),*) => (
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    53
        match $var {
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    54
            $($num => (proto_msg_case!($constr $res)).boxed()),*,
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    55
            _ => Just($default).boxed()
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    56
        }
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    57
    )
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    58
}
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    59
13437
ee3fa3b8809d Fix cmd parsing & update tests
alfadur
parents: 13426
diff changeset
    60
/// Wrapper type for generating non-empty strings
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    61
#[derive(Debug)]
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    62
struct Ascii(String);
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    63
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    64
impl Arbitrary for Ascii {
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    65
    type Parameters = <String as Arbitrary>::Parameters;
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    66
13671
09f4a30e50cc Rust 2018 conversion
alfadur
parents: 13533
diff changeset
    67
    fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
13487
7f3289a239dd Optimize test string generation
alfadur
parents: 13483
diff changeset
    68
        "[a-zA-Z0-9]+".prop_map(Ascii).boxed()
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    69
    }
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    70
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    71
    type Strategy = BoxedStrategy<Ascii>;
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    72
}
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
    73
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    74
impl Arbitrary for GameCfg {
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    75
    type Parameters = ();
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    76
13671
09f4a30e50cc Rust 2018 conversion
alfadur
parents: 13533
diff changeset
    77
    fn arbitrary_with(_args: <Self as Arbitrary>::Parameters) -> <Self as Arbitrary>::Strategy {
09f4a30e50cc Rust 2018 conversion
alfadur
parents: 13533
diff changeset
    78
        use crate::server::coretypes::GameCfg::*;
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    79
        (0..10)
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    80
            .no_shrink()
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    81
            .prop_flat_map(|i| {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    82
                proto_msg_match!(i, def = FeatureSize(0),
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    83
            0 => FeatureSize(u32),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    84
            1 => MapType(Ascii),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    85
            2 => MapGenerator(u32),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    86
            3 => MazeSize(u32),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    87
            4 => Seed(Ascii),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    88
            5 => Template(u32),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    89
            6 => Ammo(Ascii, Option<Ascii>),
13806
5fb40c8e5542 port some legacy protocol support
alfadur
parents: 13803
diff changeset
    90
            7 => Scheme(Ascii, Vec<Ascii>),
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    91
            8 => Script(Ascii),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    92
            9 => Theme(Ascii),
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    93
            10 => DrawnMap(Ascii))
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    94
            })
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
    95
            .boxed()
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    96
    }
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    97
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    98
    type Strategy = BoxedStrategy<GameCfg>;
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
    99
}
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   100
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   101
impl Arbitrary for TeamInfo {
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   102
    type Parameters = ();
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   103
13671
09f4a30e50cc Rust 2018 conversion
alfadur
parents: 13533
diff changeset
   104
    fn arbitrary_with(_args: <Self as Arbitrary>::Parameters) -> <Self as Arbitrary>::Strategy {
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   105
        (
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   106
            "[a-z]+",
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   107
            0u8..127u8,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   108
            "[a-z]+",
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   109
            "[a-z]+",
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   110
            "[a-z]+",
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   111
            "[a-z]+",
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   112
            0u8..127u8,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   113
        )
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   114
            .prop_map(|(name, color, grave, fort, voice_pack, flag, difficulty)| {
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   115
                fn hog(n: u8) -> HedgehogInfo {
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   116
                    HedgehogInfo {
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   117
                        name: format!("hog{}", n),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   118
                        hat: format!("hat{}", n),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   119
                    }
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   120
                }
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   121
                let hedgehogs = [
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   122
                    hog(1),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   123
                    hog(2),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   124
                    hog(3),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   125
                    hog(4),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   126
                    hog(5),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   127
                    hog(6),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   128
                    hog(7),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   129
                    hog(8),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   130
                ];
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   131
                TeamInfo {
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   132
                    name,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   133
                    color,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   134
                    grave,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   135
                    fort,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   136
                    voice_pack,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   137
                    flag,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   138
                    difficulty,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   139
                    hedgehogs,
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   140
                    hedgehogs_number: 0,
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   141
                }
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   142
            })
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   143
            .boxed()
13444
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   144
    }
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   145
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   146
    type Strategy = BoxedStrategy<TeamInfo>;
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   147
}
c4f917c6be51 add missing message tests
alfadur
parents: 13442
diff changeset
   148
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
   149
pub fn gen_proto_msg() -> BoxedStrategy<HWProtocolMessage> where {
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
   150
    let res = (0..58).no_shrink().prop_flat_map(|i| {
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
   151
        proto_msg_match!(i, def = Malformed,
14462
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   152
            0 => Ping(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   153
            1 => Pong(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   154
            2 => Quit(Option<Ascii>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   155
            //3 => Cmd
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   156
            4 => Global(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   157
            5 => Watch(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   158
            6 => ToggleServerRegisteredOnly(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   159
            7 => SuperPower(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   160
            8 => Info(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   161
            9 => Nick(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   162
            10 => Proto(u16),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   163
            11 => Password(Ascii, Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   164
            12 => Checker(u16, Ascii, Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   165
            13 => List(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   166
            14 => Chat(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   167
            15 => CreateRoom(Ascii, Option<Ascii>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   168
            16 => JoinRoom(Ascii, Option<Ascii>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   169
            17 => Follow(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   170
            18 => Rnd(Vec<Ascii>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   171
            19 => Kick(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   172
            20 => Ban(Ascii, Ascii, u32),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   173
            21 => BanIP(Ascii, Ascii, u32),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   174
            22 => BanNick(Ascii, Ascii, u32),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   175
            23 => BanList(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   176
            24 => Unban(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   177
            //25 => SetServerVar(ServerVar),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   178
            26 => GetServerVar(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   179
            27 => RestartServer(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   180
            28 => Stats(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   181
            29 => Part(Option<Ascii>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   182
            30 => Cfg(GameCfg),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   183
            31 => AddTeam(Box<TeamInfo>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   184
            32 => RemoveTeam(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   185
            33 => SetHedgehogsNumber(Ascii, u8),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   186
            34 => SetTeamColor(Ascii, u8),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   187
            35 => ToggleReady(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   188
            36 => StartGame(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   189
            37 => EngineMessage(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   190
            38 => RoundFinished(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   191
            39 => ToggleRestrictJoin(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   192
            40 => ToggleRestrictTeams(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   193
            41 => ToggleRegisteredOnly(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   194
            42 => RoomName(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   195
            43 => Delegate(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   196
            44 => TeamChat(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   197
            45 => MaxTeams(u8),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   198
            46 => Fix(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   199
            47 => Unfix(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   200
            48 => Greeting(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   201
            //49 => CallVote(Option<(String, Option<String>)>),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   202
            50 => Vote(bool),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   203
            51 => ForceVote(bool),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   204
            52 => Save(Ascii, Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   205
            53 => Delete(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   206
            54 => SaveRoom(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   207
            55 => LoadRoom(Ascii),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   208
            56 => Malformed(),
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   209
            57 => Empty()
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   210
        )
98ef2913ec73 Apply rustfmt to all files
unc0rr
parents: 14420
diff changeset
   211
    });
13424
81e0ed105f5d implementation of team related messages
alfadur
parents:
diff changeset
   212
    res.boxed()
13426
d1368c776a4f Enable all lints from the rust-2018-idioms suite.
marmistrz
parents: 13424
diff changeset
   213
}