Start outlining ipc subsystem
authorunC0Rr
Tue, 20 Nov 2018 16:56:24 +0100
changeset 14255 a239e4243cf9
parent 14254 9f4d75fa4a2c
child 14256 73d514c0bdf5
Start outlining ipc subsystem
rust/hedgewars-engine-messages/src/messages.rs
rust/hedgewars-engine-messages/src/parser.rs
rust/lib-hedgewars-engine/Cargo.toml
rust/lib-hedgewars-engine/src/command.rs
rust/lib-hedgewars-engine/src/ipc.rs
rust/lib-hedgewars-engine/src/lib.rs
--- a/rust/hedgewars-engine-messages/src/messages.rs	Tue Nov 20 16:18:42 2018 +0100
+++ b/rust/hedgewars-engine-messages/src/messages.rs	Tue Nov 20 16:56:24 2018 +0100
@@ -220,7 +220,7 @@
             ChatMessage(str) => ems![b's', str],
             TeamMessage(str) => ems![b'b', str],
             Error(str) => ems![b'E', str],
-            Warning(str) => unreachable!(),
+            Warning(_) => unreachable!(),
             StopSyncing => unreachable!(),
             GameOver => em![b'q'],
             GameInterrupted => em![b'Q'],
--- a/rust/hedgewars-engine-messages/src/parser.rs	Tue Nov 20 16:18:42 2018 +0100
+++ b/rust/hedgewars-engine-messages/src/parser.rs	Tue Nov 20 16:56:24 2018 +0100
@@ -70,7 +70,7 @@
 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!("E") >> s: string_tail >> ( UnorderedEngineMessage::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
--- a/rust/lib-hedgewars-engine/Cargo.toml	Tue Nov 20 16:18:42 2018 +0100
+++ b/rust/lib-hedgewars-engine/Cargo.toml	Tue Nov 20 16:56:24 2018 +0100
@@ -7,11 +7,13 @@
 [dependencies]
 gfx = "0.17"
 gfx_device_gl = "0.15"
+netbuf = "0.4"
 
 land2d = { path = "../land2d" }
 lfprng = { path = "../lfprng" }
 integral-geometry = { path = "../integral-geometry" }
 landgen = { path = "../landgen" }
+hedgewars-engine-messages = { path = "../hedgewars-engine-messages" }
 
 [lib]
 name = "hedgewars_engine"
--- a/rust/lib-hedgewars-engine/src/command.rs	Tue Nov 20 16:18:42 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-pub enum Command {
-    ChatMessage(String),
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/lib-hedgewars-engine/src/ipc.rs	Tue Nov 20 16:56:24 2018 +0100
@@ -0,0 +1,13 @@
+use hedgewars_engine_messages::{messages::*, parser};
+use netbuf::*;
+
+pub struct IPC {
+    in_buffer: Buf,
+    out_buffer: Buf,
+}
+
+impl IPC {
+    pub fn new() -> Self {
+
+    }
+}
--- a/rust/lib-hedgewars-engine/src/lib.rs	Tue Nov 20 16:18:42 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/lib.rs	Tue Nov 20 16:56:24 2018 +0100
@@ -1,5 +1,5 @@
 mod world;
-mod command;
+mod ipc;
 
 #[repr(C)]
 pub struct EngineInstance {