diff --git a/src/fot/entity.rs b/src/fot/entity.rs index e69de29..03cd1ee 100644 --- a/src/fot/entity.rs +++ b/src/fot/entity.rs @@ -0,0 +1,53 @@ +use super::raw::Raw; +use super::tag::Tag; +use super::esh::ESH; +use super::decoder::Decoder; +use super::fstring::FString; +use super::stream::{ReadStream, WriteStream}; +use anyhow::anyhow; +use anyhow::Result; + +pub enum EntityOrigin { + File, + World +} + +pub struct Entity { + origin: EntityOrigin, + tag: Option, + pub id: usize, + pub flags: u32, + pub type_idx: u16, + pub type_name: FString, + pub esh: ESH, + enc_size: usize +} + +pub struct EntityOpt { + pub origin: EntityOrigin, + pub flags: u32, + pub type_idx: u16, + pub type_name: Option, +} + +impl Decoder for Entity { + type Opt = EntityOpt; + fn decode(raw: &Raw, offset: usize, _: usize, opt: Option) -> Result { + let rd = ReadStream::new(raw, offset); + let opt = match opt { + Some(opt) => opt, + None => return Err(anyhow!("no EntityOpt was provided!")) + }; + + + todo!(); + } + + fn encode(&self) -> Result { + todo!(); + } + + fn get_enc_size(&self) -> usize { + todo!(); + } +}