From e1d51ff2da4c145f8da2c2502fa7a9201d613e19 Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Mon, 20 Jan 2025 09:11:09 -0800
Subject: [PATCH] rename stupidly named file enums

---
 strafe-client/src/file.rs   | 28 ++++++++++++++--------------
 strafe-client/src/window.rs |  6 +++---
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/strafe-client/src/file.rs b/strafe-client/src/file.rs
index 2f5263cf..229f818b 100644
--- a/strafe-client/src/file.rs
+++ b/strafe-client/src/file.rs
@@ -22,7 +22,7 @@ impl std::fmt::Display for ReadError{
 }
 impl std::error::Error for ReadError{}
 
-enum Format{
+pub enum ReadFormat{
 	#[cfg(feature="roblox")]
 	Roblox(strafesnet_rbx_loader::Model),
 	#[cfg(feature="source")]
@@ -33,21 +33,21 @@ enum Format{
 	SNFB(strafesnet_snf::bot::Segment),
 }
 
-pub fn read<R:Read+std::io::Seek>(input:R)->Result<Format,ReadError>{
+pub fn read<R:Read+std::io::Seek>(input:R)->Result<ReadFormat,ReadError>{
 	let mut buf=std::io::BufReader::new(input);
 	let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?;
 	match &peek[0..4]{
 		#[cfg(feature="roblox")]
-		b"<rob"=>Ok(Format::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
+		b"<rob"=>Ok(ReadFormat::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
 		#[cfg(feature="source")]
-		b"VBSP"=>Ok(Format::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
+		b"VBSP"=>Ok(ReadFormat::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
 		#[cfg(feature="snf")]
-		b"SNFM"=>Ok(Format::SNFM(
+		b"SNFM"=>Ok(ReadFormat::SNFM(
 			strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)?
 			.into_complete_map().map_err(ReadError::StrafesNETMap)?
 		)),
 		#[cfg(feature="snf")]
-		b"SNFB"=>Ok(Format::SNFB(
+		b"SNFB"=>Ok(ReadFormat::SNFB(
 			strafesnet_snf::read_bot(buf).map_err(ReadError::StrafesNET)?
 			.read_all().map_err(ReadError::StrafesNETBot)?
 		)),
@@ -68,23 +68,23 @@ impl std::fmt::Display for LoadError{
 }
 impl std::error::Error for LoadError{}
 
-pub enum Format2{
+pub enum LoadFormat{
 	#[cfg(feature="snf")]
 	Map(strafesnet_common::map::CompleteMap),
 	#[cfg(feature="snf")]
 	Bot(strafesnet_snf::bot::Segment),
 }
 
-pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<Format2,LoadError>{
+pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<LoadFormat,LoadError>{
 	//blocking because it's simpler...
 	let file=std::fs::File::open(path).map_err(LoadError::File)?;
 	match read(file).map_err(LoadError::ReadError)?{
 		#[cfg(feature="snf")]
-		Format::SNFB(bot)=>Ok(Format2::Bot(bot)),
+		ReadFormat::SNFB(bot)=>Ok(LoadFormat::Bot(bot)),
 		#[cfg(feature="snf")]
-		Format::SNFM(map)=>Ok(Format2::Map(map)),
+		ReadFormat::SNFM(map)=>Ok(LoadFormat::Map(map)),
 		#[cfg(feature="roblox")]
-		Format::Roblox(model)=>{
+		ReadFormat::Roblox(model)=>{
 			let mut place=model.into_place();
 			place.run_scripts();
 
@@ -117,10 +117,10 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<Format2,LoadError>{
 				)
 			);
 
-			Ok(Format2::Map(map))
+			Ok(LoadFormat::Map(map))
 		},
 		#[cfg(feature="source")]
-		Format::Source(bsp)=>{
+		ReadFormat::Source(bsp)=>{
 			let mut loader=strafesnet_deferred_loader::source_legacy();
 
 			let (texture_loader,mesh_loader)=loader.get_inner_mut();
@@ -156,7 +156,7 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<Format2,LoadError>{
 				),
 			);
 
-			Ok(Format2::Map(map))
+			Ok(LoadFormat::Map(map))
 		},
 	}
 }
diff --git a/strafe-client/src/window.rs b/strafe-client/src/window.rs
index 6c8719c9..b9a73f12 100644
--- a/strafe-client/src/window.rs
+++ b/strafe-client/src/window.rs
@@ -1,7 +1,7 @@
 use strafesnet_common::instruction::TimedInstruction;
 use strafesnet_common::session::{Time as SessionTime,TimeInner as SessionTimeInner};
 use strafesnet_common::physics::{MiscInstruction,SetControlInstruction};
-use crate::file::Format2;
+use crate::file::LoadFormat;
 use crate::physics_worker::Instruction as PhysicsWorkerInstruction;
 use crate::session::{SessionInputInstruction,SessionControlInstruction,SessionPlaybackInstruction};
 
@@ -30,8 +30,8 @@ impl WindowContext<'_>{
 		match event{
 			winit::event::WindowEvent::DroppedFile(path)=>{
 				match crate::file::load(path.as_path()){
-					Ok(Format2::Map(map))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::ChangeMap(map)}).unwrap(),
-					Ok(Format2::Bot(bot))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::LoadReplay(bot)}).unwrap(),
+					Ok(LoadFormat::Map(map))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::ChangeMap(map)}).unwrap(),
+					Ok(LoadFormat::Bot(bot))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::LoadReplay(bot)}).unwrap(),
 					Err(e)=>println!("Failed to load file: {e}"),
 				}
 			},