From bf5810c4d75bbae6f8b6c7cb4c5fcf31b95f9f5f Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:42:18 +0300 Subject: [PATCH] little refactor --- src/fot/raw.rs | 13 ------------- src/fot/save.rs | 2 +- src/fot/stream.rs | 4 ---- src/fot/world.rs | 8 +------- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/fot/raw.rs b/src/fot/raw.rs index cecd410..425adb4 100644 --- a/src/fot/raw.rs +++ b/src/fot/raw.rs @@ -15,19 +15,6 @@ pub struct Raw { } impl Raw { - pub fn join(offset: usize, size: usize, raws: &mut [Raw]) -> Raw { - let mut mem: Vec = Vec::new(); - for raw in raws.iter_mut() { - mem.append(&mut raw.mem); - } - - Raw { - offset: offset, - size: size, - mem: mem, - } - } - pub fn find_str(&self, str: &str, offset: usize) -> Option { let search = TwoWaySearcher::new(str.as_bytes()); search.search_in(&self.mem[offset..]) diff --git a/src/fot/save.rs b/src/fot/save.rs index 8e81db3..d047a77 100644 --- a/src/fot/save.rs +++ b/src/fot/save.rs @@ -1,4 +1,4 @@ -use super::decoder::{Decoder, DecoderCtx}; +use super::decoder::DecoderCtx; use super::raw::Raw; use super::stream::{ReadStream, WriteStream}; use super::world::World; diff --git a/src/fot/stream.rs b/src/fot/stream.rs index 03b63cc..1fc9c0b 100644 --- a/src/fot/stream.rs +++ b/src/fot/stream.rs @@ -115,10 +115,6 @@ impl WriteStream { } } - pub fn offset(&self) -> usize { - self.buf.position() as usize - } - pub fn skip(&mut self, size: usize) { self.buf.set_position(self.buf.position() + size as u64); } diff --git a/src/fot/world.rs b/src/fot/world.rs index 1457cab..b14f0f3 100644 --- a/src/fot/world.rs +++ b/src/fot/world.rs @@ -1,9 +1,7 @@ -use crate::fot::attributes; - use super::decoder::DecoderCtx; use super::entitylist::{EntityEncoding, EntityList}; +use super::esh::ESHValue; use super::fstring::FString; -use super::raw::Raw; use super::sgd::SGD; use super::ssg::SSG; use super::stream::{ReadStream, WriteStream}; @@ -13,10 +11,6 @@ use anyhow::Result; use deflate::deflate_bytes_zlib; use inflate::inflate_bytes_zlib; -use super::attributes::Attributes; -use super::esh::{ESHValue, ESH}; -use std::path::Path; - pub struct World { pub offset: usize, pub size: usize,