]> git.lizzy.rs Git - mt_net.git/blobdiff - src/to_srv.rs
Add wrappers around mt_rudp
[mt_net.git] / src / to_srv.rs
index 704acdb78e111c040339047f99b362a866bc2256..dc9a34210d9843f6903a0171c232a006d21204e6 100644 (file)
@@ -77,6 +77,10 @@ pub enum ToSrvPkt {
         #[mt(len = "u8")]
         blocks: Vec<[i16; 3]>,
     } = 37,
+    HaveMedia {
+        #[mt(len = "u8")]
+        tokens: Vec<u32>,
+    } = 41,
     InvAction {
         #[mt(len = "()")]
         action: String,
@@ -113,7 +117,7 @@ pub enum ToSrvPkt {
         #[mt(len = "(DefCfg, (DefCfg, u32))")]
         fields: HashMap<String, String>,
     } = 60,
-    ReqMedia {
+    RequestMedia {
         filenames: Vec<String>,
     } = 64,
     CltReady {
@@ -138,3 +142,24 @@ pub enum ToSrvPkt {
     } = 82,
     Disco = 0xffff,
 }
+
+impl PktInfo for ToSrvPkt {
+    fn pkt_info(&self) -> (u8, bool) {
+        use ToSrvPkt::*;
+
+        match self {
+            Init { .. } => (1, false),
+            Init2 { .. }
+            | RequestMedia { .. }
+            | CltReady { .. }
+            | FirstSrp { .. }
+            | SrpBytesA { .. }
+            | SrpBytesM { .. } => (1, true),
+            PlayerPos { .. } => (0, false),
+            GotBlocks { .. } | HaveMedia { .. } | DeletedBlocks { .. } | RemovedSounds { .. } => {
+                (2, true)
+            }
+            _ => (0, true),
+        }
+    }
+}