From f3174cd191fe641c720a5ab547846bf06653dc00 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 14:45:10 -0800 Subject: [PATCH] use boxed str --- src/source_legacy.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/source_legacy.rs b/src/source_legacy.rs index 5ccd98b..c6eadd2 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -1,11 +1,10 @@ use std::io::Read; -use std::path::PathBuf; use std::collections::HashMap; use crate::texture::{Texture,Textures}; use strafesnet_common::model::{MeshId,TextureId}; pub struct TextureLoader{ - texture_paths:HashMap, + texture_paths:HashMap,TextureId>, } impl TextureLoader{ pub fn acquire_texture_id(&mut self,name:&str)->TextureId{ @@ -14,7 +13,7 @@ impl TextureLoader{ } } pub struct MeshLoader{ - mesh_paths:HashMap, + mesh_paths:HashMap,MeshId>, } impl MeshLoader{ pub fn acquire_mesh_id(&mut self,name:&str)->MeshId{ @@ -43,7 +42,7 @@ impl Loader{ pub fn load_textures(&self)->Result{ let mut texture_data=vec![Vec::::new();self.texture_loader.texture_paths.len()]; for (texture_path,texture_id) in &self.texture_loader.texture_paths{ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path.display())); + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); if let Ok(mut file)=std::fs::File::open(path){ //TODO: parallel file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?;