rust/hedgewars-engine-messages/src/parser.rs
changeset 14254 9f4d75fa4a2c
parent 14214 77b95406631e
child 14255 a239e4243cf9
--- a/rust/hedgewars-engine-messages/src/parser.rs	Tue Nov 20 00:09:35 2018 +0100
+++ b/rust/hedgewars-engine-messages/src/parser.rs	Tue Nov 20 16:18:42 2018 +0100
@@ -70,6 +70,8 @@
 named!(unordered_message<&[u8], UnorderedEngineMessage>, alt!(
       do_parse!(tag!("?") >> ( Ping ))
     | do_parse!(tag!("!") >> ( Ping ))
+    | do_parse!(tag!("E") >> s: string_tail >> ( Error(s)) )
+    | do_parse!(tag!("W") >> s: string_tail >> ( Warning(s)) )
     | do_parse!(tag!("s") >> s: string_tail >> ( ChatMessage(s)) )
     | do_parse!(tag!("b") >> s: string_tail >> ( TeamMessage(s)) ) // TODO: wtf is the format
     | do_parse!(tag!("M") >> s: string_tail >> ( GameSetupChecksum(s)) )
@@ -138,6 +140,8 @@
         Ok((&b""[..], Synced(Left(Press), 258)))
     );
     assert_eq!(message(b"\x01#"), Ok((&b""[..], Synced(TimeWrap, 65535))));
+
+    assert_eq!(message(&vec![9, b'p', 255, 133, 151, 1, 0, 2, 0, 0]), Ok((&b""[..], Synced(Put(-31337, 65538), 0))));
 }
 
 #[test]