gameServer2/src/protocol/messages.rs
changeset 13524 5359ff75da3a
parent 13520 1ee192f13456
child 13527 e3ae9eea0689
equal deleted inserted replaced
13523:8c5dd562c9f7 13524:5359ff75da3a
    39     RestartServer,
    39     RestartServer,
    40     Stats,
    40     Stats,
    41     // in room
    41     // in room
    42     Part(Option<String>),
    42     Part(Option<String>),
    43     Cfg(GameCfg),
    43     Cfg(GameCfg),
    44     AddTeam(TeamInfo),
    44     AddTeam(Box<TeamInfo>),
    45     RemoveTeam(String),
    45     RemoveTeam(String),
    46     SetHedgehogsNumber(String, u8),
    46     SetHedgehogsNumber(String, u8),
    47     SetTeamColor(String, u8),
    47     SetTeamColor(String, u8),
    48     ToggleReady,
    48     ToggleReady,
    49     StartGame,
    49     StartGame,
   243             _ => panic!("Protocol message not yet implemented")
   243             _ => panic!("Protocol message not yet implemented")
   244         }
   244         }
   245     }
   245     }
   246 }
   246 }
   247 
   247 
   248 fn construct_message(header: &[&str], msg: &Vec<String>) -> String {
   248 fn construct_message(header: &[&str], msg: &[String]) -> String {
   249     let mut v: Vec<_> = header.iter().map(|s| *s).collect();
   249     let mut v: Vec<_> = header.iter().map(|s| *s).collect();
   250     v.extend(msg.iter().map(|s| &s[..]));
   250     v.extend(msg.iter().map(|s| &s[..]));
   251     v.push("\n");
   251     v.push("\n");
   252     v.join("\n")
   252     v.join("\n")
   253 }
   253 }