gameServer2/src/protocol/messages.rs
changeset 12138 81df2e1f9ae9
parent 12136 a4d22f197bd2
child 12140 23ee939ba66a
equal deleted inserted replaced
12137:1525923cd7e3 12138:81df2e1f9ae9
     2 use std;
     2 use std;
     3 use std::ops;
     3 use std::ops;
     4 use std::convert::From;
     4 use std::convert::From;
     5 
     5 
     6 #[derive(PartialEq, Debug)]
     6 #[derive(PartialEq, Debug)]
     7 pub enum HWProtocolMessage {
     7 pub enum HWProtocolMessage<'a> {
     8     // core
     8     // core
     9     Ping,
     9     Ping,
    10     Pong,
    10     Pong,
    11     Quit(Option<String>),
    11     Quit(Option<&'a str>),
    12     //Cmd(String, Vec<String>),
    12     //Cmd(&'a str, Vec<&'a str>),
    13     Global(String),
    13     Global(&'a str),
    14     Watch(String),
    14     Watch(&'a str),
    15     ToggleServerRegisteredOnly,
    15     ToggleServerRegisteredOnly,
    16     SuperPower,
    16     SuperPower,
    17     Info(String),
    17     Info(&'a str),
    18     // not entered state
    18     // not entered state
    19     Nick(String),
    19     Nick(&'a str),
    20     Proto(u32),
    20     Proto(u32),
    21     Password(String, String),
    21     Password(&'a str, &'a str),
    22     Checker(String),
    22     Checker(&'a str),
    23     // lobby
    23     // lobby
    24     List,
    24     List,
    25     Chat(String),
    25     Chat(&'a str),
    26     CreateRoom(String, Option<String>),
    26     CreateRoom(&'a str, Option<&'a str>),
    27     Join(String, Option<String>),
    27     Join(&'a str, Option<&'a str>),
    28     Follow(String),
    28     Follow(&'a str),
    29     Rnd(Vec<String>),
    29     Rnd(Vec<&'a str>),
    30     Kick(String),
    30     Kick(&'a str),
    31     Ban(String, String, u32),
    31     Ban(&'a str, &'a str, u32),
    32     BanIP(String, String, u32),
    32     BanIP(&'a str, &'a str, u32),
    33     BanNick(String, String, u32),
    33     BanNick(&'a str, &'a str, u32),
    34     BanList,
    34     BanList,
    35     Unban(String),
    35     Unban(&'a str),
    36     SetServerVar(ServerVar),
    36     SetServerVar(ServerVar),
    37     GetServerVar,
    37     GetServerVar,
    38     RestartServer,
    38     RestartServer,
    39     Stats,
    39     Stats,
    40     // in room
    40     // in room
    41     Part(Option<String>),
    41     Part(Option<&'a str>),
    42     Cfg(GameCfg),
    42     Cfg(GameCfg),
    43     AddTeam(TeamInfo),
    43     AddTeam(TeamInfo),
    44     RemoveTeam(String),
    44     RemoveTeam(&'a str),
    45     SetHedgehogsNumber(String, u8),
    45     SetHedgehogsNumber(&'a str, u8),
    46     SetTeamColor(String, u8),
    46     SetTeamColor(&'a str, u8),
    47     ToggleReady,
    47     ToggleReady,
    48     StartGame,
    48     StartGame,
    49     EngineMessage,
    49     EngineMessage(&'a str),
    50     RoundFinished,
    50     RoundFinished,
    51     ToggleRestrictJoin,
    51     ToggleRestrictJoin,
    52     ToggleRestrictTeams,
    52     ToggleRestrictTeams,
    53     ToggleRegisteredOnly,
    53     ToggleRegisteredOnly,
    54     RoomName(String),
    54     RoomName(&'a str),
    55     Delegate(String),
    55     Delegate(&'a str),
    56     TeamChat(String),
    56     TeamChat(&'a str),
    57     MaxTeams(u8),
    57     MaxTeams(u8),
    58     Fix,
    58     Fix,
    59     Unfix,
    59     Unfix,
    60     Greeting(String),
    60     Greeting(&'a str),
    61     CallVote(Option<(String, Option<String>)>),
    61     CallVote(Option<(&'a str, Option<&'a str>)>),
    62     Vote(String),
    62     Vote(&'a str),
    63     ForceVote(String),
    63     ForceVote(&'a str),
    64     Save(String, String),
    64     Save(&'a str, &'a str),
    65     Delete(String, String),
    65     Delete(&'a str, &'a str),
    66     SaveRoom(String),
    66     SaveRoom(&'a str),
    67     LoadRoom(String),
    67     LoadRoom(&'a str),
    68 }
    68 }
    69 
    69 
    70 pub fn number<T: From<u8>
    70 pub fn number<T: From<u8>
    71                 + std::default::Default
    71                 + std::default::Default
    72                 + std::ops::MulAssign
    72                 + std::ops::MulAssign