Start outlining some core engine stuff
authorunc0rr
Thu, 08 Nov 2018 00:00:58 +0100
changeset 14174 e2c51c8e0b2e
parent 14173 5c6f947c342c
child 14175 a4c1a2d0ac24
Start outlining some core engine stuff
rust/lib-hedgewars-engine/src/command.rs
rust/lib-hedgewars-engine/src/engine_message.rs
rust/lib-hedgewars-engine/src/lib.rs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/lib-hedgewars-engine/src/command.rs	Thu Nov 08 00:00:58 2018 +0100
@@ -0,0 +1,4 @@
+pub enum Command {
+    SetAmmo(String),
+    ChatMessage(String),
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/lib-hedgewars-engine/src/engine_message.rs	Thu Nov 08 00:00:58 2018 +0100
@@ -0,0 +1,55 @@
+use crate::command::Command;
+
+pub enum KeystrokeAction {
+    Press,
+    Release,
+}
+
+pub enum SyncedEngineMessage {
+    Left(KeystrokeAction),
+    Right(KeystrokeAction),
+    Up(KeystrokeAction),
+    Down(KeystrokeAction),
+    Precise(KeystrokeAction),
+    NextTurn,
+    Switch,
+    Empty,
+    Timer(u8),
+    Slot(u8),
+    SetWeapon(u8),
+    Put(i32, i32),
+    HighJump,
+    LowJump,
+    Skip,
+    TeamControlGained(String),
+    TeamControlLost(String),
+}
+
+pub enum UnsyncedEngineMessage {
+    Ping,
+    Pong,
+    Say(String),
+    Taunt(u8),
+    ExecCommand(Command),
+    GameType(u8),// TODO: use enum
+    Warning(String),
+    StopSyncing,
+    ConfigRequest,
+    GameOver,
+    GameInterrupted,
+}
+
+pub enum EngineMessage {
+    Synced(SyncedEngineMessage, u32),
+    Unsynced(UnsyncedEngineMessage),
+}
+
+impl EngineMessage {
+    fn from_bytes(buf: &[u8]) -> Self {
+        unimplemented!()
+    }
+
+    fn to_bytes(&self) -> Vec<u8> {
+        unimplemented!()
+    }
+}
--- a/rust/lib-hedgewars-engine/src/lib.rs	Wed Nov 07 23:43:15 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/lib.rs	Thu Nov 08 00:00:58 2018 +0100
@@ -4,6 +4,8 @@
 extern crate lfprng;
 
 mod world;
+mod engine_message;
+mod command;
 
 #[repr(C)]
 pub struct EngineInstance {