From f1badb79ca123bc468c91221bfe9b4ec03bba672 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Thu, 22 Feb 2024 14:55:31 +0900 Subject: [PATCH] Don't de/serialize some particles --- src/original_impl.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/original_impl.rs b/src/original_impl.rs index 909b2b6..c7f1179 100644 --- a/src/original_impl.rs +++ b/src/original_impl.rs @@ -1317,9 +1317,10 @@ impl Planet { planet.color = color; idx += color_size; - let (psystem, psystem_size) = ParticleSystem::deserialize(data, offset + idx)?; - planet.particle_system = psystem; - idx += psystem_size; + // No need to deserialize ParticleSystem + //let (psystem, psystem_size) = ParticleSystem::deserialize(data, offset + idx)?; + //planet.particle_system = psystem; + //idx += psystem_size; if data.len() < offset + idx + std::mem::size_of::() { return Err(()); @@ -1344,7 +1345,9 @@ impl Planet { bytes.append(&mut self.circle.serialize()); bytes.append(&mut self.color.serialize()); - bytes.append(&mut self.particle_system.serialize()); + + // No need to serialize ParticleSystem. + //bytes.append(&mut self.particle_system.serialize()); let moons_size = self.moons.len(); bytes.extend(moons_size.to_be_bytes()); @@ -1442,9 +1445,10 @@ impl Star { star.color = color; idx += color_size; - let (psystem, psystem_size) = ParticleSystem::deserialize(data, offset + idx)?; - star.particle_system = psystem; - idx += psystem_size; + // No need to deserialize ParticleSystem. + //let (psystem, psystem_size) = ParticleSystem::deserialize(data, offset + idx)?; + //star.particle_system = psystem; + //idx += psystem_size; if data.len() < offset + idx + std::mem::size_of::() { return Err(()); @@ -1473,7 +1477,9 @@ impl Star { let mut bytes = Vec::new(); bytes.append(&mut self.color.serialize()); - bytes.append(&mut self.particle_system.serialize()); + + // No need to serialize ParticleSystem. + //bytes.append(&mut self.particle_system.serialize()); bytes.extend(self.velr.to_be_bytes()); bytes.extend(self.r.to_be_bytes());