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..8d6530b 100644 --- a/src/file.rs +++ b/src/file.rs @@ -6,6 +6,7 @@ pub enum ReadError{ Roblox(strafesnet_rbx_loader::ReadError), #[cfg(feature="source")] Source(strafesnet_bsp_loader::ReadError), + #[cfg(feature="snf")] StrafesNET(strafesnet_snf::Error), StrafesNETMap(strafesnet_snf::map::Error), Io(std::io::Error), @@ -23,6 +24,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 +36,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 +62,7 @@ pub fn load>(path:P)->ResultOk(map), #[cfg(feature="roblox")] DataStructure::Roblox(dom)=>{