mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-23 19:29:48 +02:00
Break: refactor the packet payloads
This commit is contained in:
1 parent
9d601082d6
commit
e48fe1dd0d
8 files changed
+70
-70
No files matched your search
@@ -1,3 +1,5 @@
|
||||
use std::io::Read;
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use serde::Serialize;
|
||||
use serde_with::serde_as;
|
||||
@@ -7,10 +9,11 @@ use crate::result::Result;
|
||||
#[serde_as]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub enum EntityMethod {
|
||||
/// TODO: team composition.
|
||||
Subtype2F(#[serde_as(as = "serde_with::hex::Hex")] Vec<u8>),
|
||||
Subtype2F {
|
||||
// prefix: [u8; 9],
|
||||
},
|
||||
|
||||
/// Default variant when subtype is not known.
|
||||
/// Default variant when subtype is not known by the parser.
|
||||
Unknown {
|
||||
sub_type: u32,
|
||||
|
||||
@@ -28,7 +31,12 @@ impl EntityMethod {
|
||||
let sub_type = reader.read_u32::<LittleEndian>()?;
|
||||
|
||||
let this = match sub_type {
|
||||
0x2F => Self::Subtype2F(payload),
|
||||
0x2F => {
|
||||
// let mut prefix = [0; 9];
|
||||
// reader.read_exact(&mut prefix)?;
|
||||
Self::Subtype2F {}
|
||||
}
|
||||
|
||||
_ => Self::Unknown { sub_type, payload },
|
||||
};
|
||||
Ok(this)
|
||||
|
||||
Reference in new issue
Block a user