diff --git a/src/fot/fstring.rs b/src/fot/fstring.rs index 04d9be0..26c87e3 100644 --- a/src/fot/fstring.rs +++ b/src/fot/fstring.rs @@ -5,6 +5,7 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use encoding_rs::WINDOWS_1251; use std::io::Cursor; use std::borrow::Borrow; +use std::hash::{Hash, Hasher}; use std::fmt; // FString - Fallout @@ -15,7 +16,7 @@ pub enum FStringEncoding { WCS2, } -#[derive(Debug, Hash, Eq, Clone)] +#[derive(Debug, Eq, Clone)] pub struct FString { pub encoding: FStringEncoding, pub enc_len: usize, @@ -88,6 +89,12 @@ impl PartialEq for FString { } } +impl Hash for FString { + fn hash(&self, state: &mut H) { + self.str.hash(state); + } +} + impl Borrow for FString { fn borrow(&self) -> &str { self.str.as_str() @@ -96,6 +103,6 @@ impl Borrow for FString { impl fmt::Display for FString { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "\"{}\"", self.str) + write!(f, "{}", self.str) } } \ No newline at end of file diff --git a/src/fot/world.rs b/src/fot/world.rs index 4b7cf5b..051f15d 100644 --- a/src/fot/world.rs +++ b/src/fot/world.rs @@ -1,7 +1,6 @@ use super::decoder::Decoder; use super::esh::ESH; use super::fstring::FString; -use super::fstring::FStringEncoding; use super::raw::Raw; use super::sgd::SGD; use super::ssg::SSG; @@ -13,7 +12,6 @@ use byteorder::{LittleEndian, WriteBytesExt}; use deflate::deflate_bytes_zlib; use inflate::inflate_bytes_zlib; use std::io::Cursor; -use std::path::Path; #[derive(Debug)] pub struct World {