forked from StrafesNET/strafe-client
snf optional as well because why not
This commit is contained in:
parent
4863605af7
commit
c59f40892a
@ -9,7 +9,8 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
|
|||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["snf"]
|
||||||
|
snf = ["dep:strafesnet_snf"]
|
||||||
source = ["dep:strafesnet_deferred_loader", "dep:strafesnet_bsp_loader"]
|
source = ["dep:strafesnet_deferred_loader", "dep:strafesnet_bsp_loader"]
|
||||||
roblox = ["dep:strafesnet_deferred_loader", "dep:strafesnet_rbx_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_common = { version = "0.2.0", registry = "strafesnet" }
|
||||||
strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true }
|
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_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"
|
wgpu = "22.0.0"
|
||||||
winit = "0.30.4"
|
winit = "0.30.4"
|
||||||
|
|
||||||
|
@ -6,7 +6,9 @@ pub enum ReadError{
|
|||||||
Roblox(strafesnet_rbx_loader::ReadError),
|
Roblox(strafesnet_rbx_loader::ReadError),
|
||||||
#[cfg(feature="source")]
|
#[cfg(feature="source")]
|
||||||
Source(strafesnet_bsp_loader::ReadError),
|
Source(strafesnet_bsp_loader::ReadError),
|
||||||
|
#[cfg(feature="snf")]
|
||||||
StrafesNET(strafesnet_snf::Error),
|
StrafesNET(strafesnet_snf::Error),
|
||||||
|
#[cfg(feature="snf")]
|
||||||
StrafesNETMap(strafesnet_snf::map::Error),
|
StrafesNETMap(strafesnet_snf::map::Error),
|
||||||
Io(std::io::Error),
|
Io(std::io::Error),
|
||||||
UnknownFileFormat,
|
UnknownFileFormat,
|
||||||
@ -23,6 +25,7 @@ pub enum DataStructure{
|
|||||||
Roblox(strafesnet_rbx_loader::Dom),
|
Roblox(strafesnet_rbx_loader::Dom),
|
||||||
#[cfg(feature="source")]
|
#[cfg(feature="source")]
|
||||||
Source(strafesnet_bsp_loader::Bsp),
|
Source(strafesnet_bsp_loader::Bsp),
|
||||||
|
#[cfg(feature="snf")]
|
||||||
StrafesNET(strafesnet_common::map::CompleteMap),
|
StrafesNET(strafesnet_common::map::CompleteMap),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +37,7 @@ pub fn read<R:Read+std::io::Seek>(input:R)->Result<DataStructure,ReadError>{
|
|||||||
b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
|
b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
|
||||||
#[cfg(feature="source")]
|
#[cfg(feature="source")]
|
||||||
b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
|
b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
|
||||||
|
#[cfg(feature="snf")]
|
||||||
b"SNFM"=>Ok(DataStructure::StrafesNET(
|
b"SNFM"=>Ok(DataStructure::StrafesNET(
|
||||||
strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)?
|
strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)?
|
||||||
.into_complete_map().map_err(ReadError::StrafesNETMap)?
|
.into_complete_map().map_err(ReadError::StrafesNETMap)?
|
||||||
@ -59,6 +63,7 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<strafesnet_common::map::Co
|
|||||||
//blocking because it's simpler...
|
//blocking because it's simpler...
|
||||||
let file=std::fs::File::open(path).map_err(LoadError::File)?;
|
let file=std::fs::File::open(path).map_err(LoadError::File)?;
|
||||||
match read(file).map_err(LoadError::ReadError)?{
|
match read(file).map_err(LoadError::ReadError)?{
|
||||||
|
#[cfg(feature="snf")]
|
||||||
DataStructure::StrafesNET(map)=>Ok(map),
|
DataStructure::StrafesNET(map)=>Ok(map),
|
||||||
#[cfg(feature="roblox")]
|
#[cfg(feature="roblox")]
|
||||||
DataStructure::Roblox(dom)=>{
|
DataStructure::Roblox(dom)=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user