From c59f40892a4064793169dff4d473a1be46d0d1fa Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 29 Jul 2024 17:28:00 -0700 Subject: [PATCH] snf optional as well because why not --- Cargo.toml | 5 +++-- src/file.rs | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4508ddf..e1295b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,8 @@ authors = ["Rhys Lloyd "] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = [] +default = ["snf"] +snf = ["dep:strafesnet_snf"] source = ["dep:strafesnet_deferred_loader", "dep:strafesnet_bsp_loader"] roblox = ["dep:strafesnet_deferred_loader", "dep:strafesnet_rbx_loader"] @@ -25,7 +26,7 @@ strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet", optional = strafesnet_common = { version = "0.2.0", registry = "strafesnet" } strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true } strafesnet_rbx_loader = { version = "0.3.2", registry = "strafesnet", optional = true } -strafesnet_snf = { version = "0.1.0", registry = "strafesnet" } +strafesnet_snf = { version = "0.1.0", registry = "strafesnet", optional = true } wgpu = "22.0.0" winit = "0.30.4" diff --git a/src/file.rs b/src/file.rs index affb652..61b5bf7 100644 --- a/src/file.rs +++ b/src/file.rs @@ -6,7 +6,9 @@ pub enum ReadError{ Roblox(strafesnet_rbx_loader::ReadError), #[cfg(feature="source")] Source(strafesnet_bsp_loader::ReadError), + #[cfg(feature="snf")] StrafesNET(strafesnet_snf::Error), + #[cfg(feature="snf")] StrafesNETMap(strafesnet_snf::map::Error), Io(std::io::Error), UnknownFileFormat, @@ -23,6 +25,7 @@ pub enum DataStructure{ Roblox(strafesnet_rbx_loader::Dom), #[cfg(feature="source")] Source(strafesnet_bsp_loader::Bsp), + #[cfg(feature="snf")] StrafesNET(strafesnet_common::map::CompleteMap), } @@ -34,6 +37,7 @@ pub fn read(input:R)->Result{ b"Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)), #[cfg(feature="source")] b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)), + #[cfg(feature="snf")] b"SNFM"=>Ok(DataStructure::StrafesNET( strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)? .into_complete_map().map_err(ReadError::StrafesNETMap)? @@ -59,6 +63,7 @@ pub fn load>(path:P)->ResultOk(map), #[cfg(feature="roblox")] DataStructure::Roblox(dom)=>{